java.lang.NoClassDefFoundError: with our java program named Processor

Sonarqube 8.2.0.32929
we are using sonarqube with maven in eclipse.
apache-maven-3.6.0
java Amazon Corretto\jdk11.0.7_10

Trying to write a simple test for a java program named Processor.java but keeps getting error message NoClassDefFoundError. I’m unable to find out why this can not be initialize. I have sonarqube working for all classes that does not use methods in this class or inherits from this class.
I can run the junit test in eclipse and they work, but in sonarqube they fail.

java.lang.NoClassDefFoundError: Could not initialize class com.xyz.cs.automationagent.processor.Processor at com.xyz.cs.automationagent.processor.ProcessorTest.testReplaceParameters(ProcessorTest.java:53)

Hello @curtisw,

Welcome to the Community!

SonarQube is never directly responsible for running unit tests. When you say “in SonarQube they fail” can you elaborate on how you’re running the analysis? Are you using maven for this? A complete log of your build/analysis output would help.

Good morning,

Yes, we are using Maven to run the analyst, “mnv clean install sonar:sonar”

This class that is in question is an abstract class, do that cause issues with sonarqube?

@Jeff_Zapotoczny

sonarout.txt (564.2 KB)

Attached is the log of the build/analysis

thanks

Hi @curtisw,

This isn’t a SonarQube issue; the failure is happening while your tests are being run (prior to any attempt at a Sonar analysis). Generally speaking, you cannot directly instantiate abstract classes in order to test them; I suggest you revisit the structure of your tests and make sure a simple maven goal to built your projects and run your tests (e.g. mvn clean verify) works successfully before proceeding into attempting Sonar analysis.