Open shangchenlin opened 5 months ago
Hi @shangchenlin,
the NoClassDefError comes from CxxUnitTestResultsAggregator
in
https://github.com/SonarOpenCommunity/sonar-cxx/blob/1be6f9d3ff826cd7f52cb6bbf512358e69f2f6b4/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/CxxPlugin.java#L80
https://github.com/SonarOpenCommunity/sonar-cxx/blob/1be6f9d3ff826cd7f52cb6bbf512358e69f2f6b4/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/CxxPlugin.java#L110
That‘s one of the first steps during setup of the plugin, long before any analysis is executed. Wondering how that could be because CI tests are running? https://github.com/SonarOpenCommunity/sonar-cxx/actions/runs/9267875389
Regards,
Duplicate #2634, #2475
The issue has been solved. The resolution was to clear the /var/lib/jenkins/.sonar tmp files and the /var/lib/jenkins/.sonar/cache as well as ensure the /var/lib/jenkins/.sonar/cache/_tmp folder had the correct ownership:group
I am running on local PC with Oracle Java 17, I didn't run any testing, I just want to analyze the .xml which cpp check gave, I have another question is that is this plugin really need cpp check? Also, this is my current SonarQube showed ![Uploading image.png…]()
is this plugin really need cpp check?
SonarQube C++ Community plugin (cxx plugin): This plugin adds C++ support to SonarQube with the focus on integration of existing C++ tools. …the main purpose of the cxx plugin is to forward reports from 3rd party tools to SonarQube. The plugin is not doing any static code analysis by its own. If you want that you have to use the SQ developer edition with the cpp plugin.
Duplicate #2634, #2475
2475 has been solved with:
The issue has been solved. The resolution was to clear the /var/lib/jenkins/.sonar tmp files and the /var/lib/jenkins/.sonar/cache as well as ensure the /var/lib/jenkins/.sonar/cache/_tmp folder had the correct ownership:group
We don't use Jenkins to run our CI jobs, but GitLab CI which launches jobs on docker containers (hence, clean) using the official image sonarsource/sonar-scanner-cli:latest and despite this hopefully clean environment, we do experience the same java.lang.ClassNotFoundException: org.sonar.cxx.sensors.tests.dotnet.CxxUnitTestResultsAggregator
issue.
NB: aggregator is used to collect compilation warnings from both Linux and Windows platforms, ccpcheck analysis, gcov results as well as valgrind output.
@guwirth do you have any hint, like using a better docker image, for instance? Or do we have to inject the pluggin, or an updated version, in the container?
We don't use Jenkins to run our CI jobs, but GitLab CI which launches jobs on docker containers (hence, clean) using the official image sonarsource/sonar-scanner-cli:latest and despite this hopefully clean environment, we do experience the same
java.lang.ClassNotFoundException: org.sonar.cxx.sensors.tests.dotnet.CxxUnitTestResultsAggregator
issue.
We have the same setup and the same problem. And ours does not even have C++ code. Removing the sonar-caches did not help. In production we run sonar-scanner-cli:5
and that's working without problems.
The NoClassDefFoundError is a runtime error in Java that occurs if the Java Virtual Machine (JVM) or a ClassLoader instance attempts to load the definition of a class but cannot find it at runtime. The class definition exists at compile-time but is not available at runtime.
What I still don’t understand is, that everything is working fine in our test environments. Why is only sometimes the dependency to the class CxxUnitTestResultsAggregator not available at runtime? Someone an idea?
Found this: https://rollbar.com/blog/java-no-class-def-found-error/
Before you create a new issue
Describe the bug When I run the command line which the SonarQube gave me, it kept jump the NoClassDefError
Screenshots
Desktop (please complete the following information):