BugsnagImportSelector incorrectly selects "javax" classes in certain Java 21 scenarios
Describe the bug
We run our Spring MVC application in a Docker container based openjdk:21-slim. The Java runtime self-reports its version as 21, rather than e.g. 21.0, causing the BugsnagImportSelector to not recognise the Java version correctly.
Steps to reproduce
- Follow the basic Spring getting started guide in a Java 21 environment where
java.versionis set to a major version string only (e.g.21rather than21.0) - The applications fails to start with
java.lang.ClassNotFoundException: javax.servlet.ServletRequestListener
Environment
- Bugsnag version: 3.7.1
- Java version: openjdk-21 (specifically, https://hub.docker.com/layers/library/openjdk/21-jdk-slim/images/sha256-6b621d87232f1b91e9a52218522f011d74f0c970ca1f12f7dce861e9014077f4)
- Spring framework version (if any): Spring Boot 3.2.1
- Maven version (if any): -
- Gradle version (if any): -
Additional Details
It appears that BugsnagImportSelector#isJava17Compatible is unable to cope with major-only version strings, and instead falls back to the default version in such scenarios.
Hi @marco-tresch
Thank you for reaching out to us with this bug report. We now have an item on our backlog aimed at investigating this issue further. Once we have more information to share we will be sure to update you here via this ticket thread.
I'm also running into the same issue, it's blocking from evaluating the product.
We're facing same issue as well with java 21 corretto. But providing the minor version does not solve the problem
Hi :wave:
We've just release a new version of the BugSnag Java notifier. The latest version should have a fix for your issues with the BugSnagImportSelector.
After updating to the latest, please let us know whether you are receiving any issues and we can investigate further.