Error messsage as required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: java/util/jar/Pack200

Hi,

I recently subscribed to Sonarcloud paid version. But I am unable to analyze my project using sonarcloud. I keep getting following error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project TGService: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: java/util/jar/Pack200

Could you please help on how to resolve this issue?

Thanks
Gowtham

Hello,

On what CI are you running the scanner ?
Does it work locally ? And does your build task work without the sonar command ?

I subscribed to SonarCloud paid version. I integrated this with gitlab.
The code compiles and build is generated successfully in my local. I am able to run the application as well.

Even I tried with other cloud tools like Codacy. I am able to get the code analysis done. But the same is not working with Sonarcloud.

Hope this information is helpful to suggest the solution.

Here are additional logs:
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:3.7.0.1746
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.7.0.1746/sonar-maven-plugin-3.7.0.1746.jar
[ERROR] urls[1] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/root/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.jar
[ERROR] urls[5] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]

Best Regards
Gowtham TG

This is most likely due to the removal of java/util/jar/Pack200 in JDK14. You could downgrade to JDK13 until sonarsource releases a new plugin version.

2 Likes

Can you please share the steps on how to to do that? As I mentioned earlier I am using “Sonarcloud” version.

Thanks

Hi. I have the same problem. I have spring application written with kotlin, then i created gitlab-ci.

I have my source code here:


In file gitlab-ci.yml is CI configuration.

And there is a log from this analysis from CI step:

Does anyone has any idea?

Your build uses the maven:latest image:

sonarcloud-check:
  image: maven:latest

This image comes with JDK14; you could switch to maven:3.6.3-jdk-11.

sonarcloud-check:
  image: maven:3.6.3-jdk-11
3 Likes

Hi Andreas,

I am using JDK 8 and using following maven versions:
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>

And the POM model version is this:
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>

Can you please suggest on where to change this? Can you please also extend the trail version, so that I can make these checks?

Thanks
Gowtham

You should do the change mentioned by @andreask in your .gitlab-ci.yml file.

1 Like

Thank you very much. It worked now.

Best Regards

Also, it works. Thank You :slight_smile: