Reputation: 121
I have some code that uses JAXB API classes. When I run the code with Java 11, at runtime I get errors indicating that "A required class was missing while executing" .
I am using jaxb version
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
</dependency>
Error org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar: javax/xml/bind/JAXBException
Is this version Issue? if I run same code on Java8 then working fine no issue has detected. but Java 11 I always getting this error
Upvotes: 2
Views: 2965
Reputation: 3540
I guess you need to include some more required dependencies apart from glassfish
. Following are the additional dependencies, check for the latest versions and include them and try executing again:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0-b170127.1453</version>
</dependency>
</dependencies>
Additionally check this: https://stackoverflow.com/a/54361901/7584240
Upvotes: 2