SonarQube error javax/xml/bind/JAXBException

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi,

Background:
I have a project with Java 11, and SonarQube version 6.5 installed.

Issue/Error:
When I call for SonarQube for scanning using “mvn sonar:sonar”, it gives javax/xml/bind/JAXBException, portion of the error below.

Things I have tried but did not work

  1. I googled that Java 11 package for javax.xml.bind does not exist anymore, so in order to fix this issue, need to manually add the JAXB Maven dependencies (Jaxb-core, Jaxb-api, Jaxb-impl) to project’s pom.xml which i have added

  2. Another suggestion is to add “sonar-maven-plugin” which i have added

  3. One also suggested to check the availability of “sonar-java-plugin” in the SonarQube installation’s plugin folder, which i have checked and is available

Let’s assume that upgrading the version of SonarQube is not readily available unless backed by strong evidence that the current setup definitely will not work.

Any help is welcome.

Thanks.

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project myapp: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar: javax/xml/bind/JAXBException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = path-to-m2/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.3.0.603/sonar-maven-plugin-3.3.0.603.jar
[ERROR] urls[1] = path-to-m2/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = path-to-m2/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = path-to-m2/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = path-to-m2/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = path-to-m2/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = path-to-m2/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = path-to-m2/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.9.0.887/sonar-scanner-api-2.9.0.887.jar
[ERROR] urls[8] = path-to-m2/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = path-to-m2/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : javax.xml.bind.JAXBException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

Hi,

Welcome to the community!

There’s the fact that SonarQube 6.5 doesn’t support Java 11…

 
:woman_shrugging:
Ann

Hi Ann,

Thanks for your reply.

I have tried to download SonarQube 6.5 and using Java 11 on my personal workstation, and I was able to call mvn sonar:sonar successfully even without internet connection (because I was trying to simulate the actual project’s environment).

But when moved to the actual project environment, it does not seem to work anymore, so that’s what baffles me.

If you would be so kind as to point me to the official documentation that states SonarQube will not work together with Java 11, then maybe it is easier for me to justify the reason for the SonarQube upgrade.

Thank you

Hi,

I don’t have a link to the 6.5 docs handy, but the 6.7 docs show compatibility with Java 8 only. Not Java 7, and not Java 9. I don’t think Java 11 was even thought of then.

 
HTH
Ann

Hi Ann,

Thanks for the documentation, I will take note of this.

Thanks