bugsnag-java icon indicating copy to clipboard operation
bugsnag-java copied to clipboard

BugsnagImportSelector incorrectly selects "javax" classes in certain Java 21 scenarios

Open marco-tresch opened this issue 2 years ago • 3 comments

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

  1. Follow the basic Spring getting started guide in a Java 21 environment where java.version is set to a major version string only (e.g. 21 rather than 21.0)
  2. 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.

marco-tresch avatar Jan 14 '24 08:01 marco-tresch

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.

clr182 avatar Jan 25 '24 14:01 clr182

I'm also running into the same issue, it's blocking from evaluating the product.

mservidio avatar Feb 28 '24 16:02 mservidio

We're facing same issue as well with java 21 corretto. But providing the minor version does not solve the problem

TimotheeVille avatar Jun 27 '24 09:06 TimotheeVille

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.

clr182 avatar Aug 29 '24 10:08 clr182