Caused by: java.lang.ClassNotFoundException: org.sonar.plugins.java.api.CheckRegistrar

SonarQube server version: 10.5.0.89998 (run on docker container)
JDK version: 21.0.2
MAVEN version: 3.9.6
SonarQube Scanner version: 5.0.1.3006
sonar-maven-plugin version: 3.11.0.3922

Jenkinsfile:

pipeline {
    agent any

    tools {
        maven 'jenkins-maven'
        jdk 'jdk-21.0.2'
        'org.jenkinsci.plugins.docker.commons.tools.DockerTool' 'jenkins_docker'
    }

    stages {
        stage('Initialize') {
            steps {
                script {
                    def dockerHome = tool 'jenkins_docker'
                    env.PATH = "${dockerHome}/bin:${env.PATH}"
                    pom = readMavenPom file: 'pom.xml'
                    env.APP_RC_VERSION = pom.version
                    env.GIT_COMMIT_SHORT = "${env.GIT_COMMIT}".substring(0,11)
                    currentBuild.displayName = "#${BUILD_NUMBER} (${APP_RC_VERSION} - ${GIT_COMMIT_SHORT})"
                }
            }
        }
        stage('Builds') {
            steps {
                script {
                    configFileProvider(
                        [configFile(fileId: '868aaa57-e532-4c6e-adec-c001dff37ede', variable: 'MAVEN_SETTINGS')]) {
                        sh 'mvn -s $MAVEN_SETTINGS clean compile -DskipTests'
                        sh 'mvn -s $MAVEN_SETTINGS package -DskipTests'
                    }
                }
            }
        }
        stage("Tests") {
            when {
                branch 'develop'
            }
            steps {
                script {
                    configFileProvider(
                        [configFile(fileId: '868aaa57-e532-4c6e-adec-c001dff37ede', variable: 'MAVEN_SETTINGS')]) {
                        sh 'mvn -s $MAVEN_SETTINGS test'
                    }
                }
            }
        }
        stage("Dependency-Check") {
                    when {
                        branch 'develop'
                    }
                    steps {
                        script {
                            configFileProvider(
                                [configFile(fileId: '868aaa57-e532-4c6e-adec-c001dff37ede', variable: 'MAVEN_SETTINGS')]) {
                                sh 'mvn -s $MAVEN_SETTINGS dependency-check:check'
                            }
                        }
                    }
                }
        stage('SonarQube analysis') {
            when {
                branch 'develop'
            }
            steps {
                withSonarQubeEnv(credentialsId: 'SONAR_TOKEN', installationName: 'BNN SonarQube Server') {
                    sh 'mvn sonar:sonar -X'
                }
            }
        }
    }

    post {
        always {
            junit 'target/surefire-reports/*.xml'
        }
    }
}

Log file:

sonarqube_analysis.log (102.1 KB)

Installed plugins:

installex_plugins.txt (16.1 KB)

Pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.2.5</version>
		<relativePath/>
	</parent>
	<groupId>network.bobnet</groupId>
	<artifactId>navigator-alligator</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>*********</name>
	<description>
		*********
	</description>
	<properties>
		<java.version>21</java.version>
		<maven.compiler.source>21</maven.compiler.source>
		<maven.compiler.target>21</maven.compiler.target>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
		<sonar.dependencyCheck.htmlReportPath>target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
	</properties>

	<!-- Developer Information -->
	<developers>
		<developer>
			*********
		</developer>
		<developer>
			*********
		</developer>
	</developers>

	<!-- Licenses Information -->
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<!-- SCM Information -->
	<scm>
		<connection>scm:git:git://*********</connection>
		<developerConnection>scm:git:ssh://*********</developerConnection>
		<url>*********</url>
	</scm>

	<distributionManagement>
		<repository>
			<id>bnn-releases</id>
			<name>Releases</name>
			<url>*********</url>
		</repository>
		<snapshotRepository>
			<id>bnn-snapshots</id>
			<name>Snapshots</name>
			<url>*********</url>
		</snapshotRepository>
	</distributionManagement>


	<dependencies>

		<!-- Web Dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springdoc</groupId>
			<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
			<version>2.5.0</version>
		</dependency>
		<dependency>
			<groupId>org.springdoc</groupId>
			<artifactId>springdoc-openapi-ui</artifactId>
			<version>1.8.0</version>
		</dependency>

		<!-- Lib for JSON Patch -->
		<dependency>
			<groupId>com.github.java-json-tools</groupId>
			<artifactId>json-patch</artifactId>
			<version>1.13</version>
		</dependency>
		<!-- Model Mapper for DTO mapping -->
		<dependency>
			<groupId>org.modelmapper</groupId>
			<artifactId>modelmapper</artifactId>
			<version>3.2.0</version>
		</dependency>

		<!-- Validation Dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-validation</artifactId>
		</dependency>

		<!-- Mail Dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-mail</artifactId>
		</dependency>

		<!-- Database Dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<scope>runtime</scope>
			<version>42.7.3</version>
		</dependency>

		<!-- Redis & Cache Dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-redis</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-cache</artifactId>
		</dependency>

		<!-- Metrics Dependencies -->
		<dependency>
			<groupId>io.micrometer</groupId>
			<artifactId>micrometer-registry-prometheus</artifactId>
			<scope>runtime</scope>
			<version>1.12.5</version>
		</dependency>

		<!-- Developer Tools -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-docker-compose</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
			<version>1.18.32</version>
		</dependency>

		<!-- Actuator -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

		<!-- Testing -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- Telemetry  -->
		<dependency>
			<groupId>io.micrometer</groupId>
			<artifactId>micrometer-tracing-bridge-otel</artifactId>
			<version>1.2.5</version>
		</dependency>
		<dependency>
			<groupId>io.opentelemetry</groupId>
			<artifactId>opentelemetry-exporter-otlp</artifactId>
			<version>1.37.0</version>
		</dependency>

	</dependencies>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.8.12</version>
				<reportSets>
					<reportSet>
						<reports>
							<report>report</report>
						</reports>
					</reportSet>
				</reportSets>
			</plugin>
			<plugin>
				<groupId>org.owasp</groupId>
				<artifactId>dependency-check-maven</artifactId>
				<version>9.1.0</version>
			</plugin>
		</plugins>
	</reporting>

	<build>
		<finalName>app</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
						</exclude>
					</excludes>
					<executable>true</executable>
				</configuration>
				<executions>
					<execution>
						<id>build-info</id>
						<goals>
							<goal>build-info</goal>
						</goals>
						<configuration>
							<additionalProperties>
								<java.version>${java.version}</java.version>
								<description>${project.description}</description>
							</additionalProperties>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.8.12</version>
				<executions>
					<execution>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<!-- attached to Maven test phase -->
					<execution>
						<id>report</id>
						<phase>test</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.springdoc</groupId>
				<artifactId>springdoc-openapi-maven-plugin</artifactId>
				<version>1.4</version>
				<executions>
					<execution>
						<id>install</id>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<apiDocsUrl>http://localhost:8080/v3/api-docs</apiDocsUrl>
					<outputFileName>${project.artifactId}-${project.version}-swagger.json</outputFileName>
					<outputDir>${project.build.directory}</outputDir>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.6.3</version>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<doclint>none</doclint>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.owasp</groupId>
				<artifactId>dependency-check-maven</artifactId>
				<version>9.1.0</version>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.sonarsource.scanner.maven</groupId>
				<artifactId>sonar-maven-plugin</artifactId>
				<version>3.11.0.3922</version>
			</plugin>
		</plugins>
	</build>
</project>

Hey there.

It looks like the issue is with GitHub - QualInsight/qualinsight-plugins-sonarqube-smell: Code Smells plugin for SonarQube and companion Java library

at com.qualinsight.plugins.sonarqube.smell.plugin.SmellPlugin.define (SmellPlugin.java:59)

I suggest reaching out to the maintainer to see if it’s compatible with SonarQube 10.5… however it also hasn’t been updated in 7 years, so maybe it’s better to uninstall it.

I turned it off, but the same error appears ( Caused by: java.lang.ClassNotFoundException: org.sonar.plugins.java.api.CheckRegistrar)

I also deleted the Codehawk plugin because I saw that it also causes this error. After that, the problem was solved. So, to solve the error, it was necessary to delete the Smell and Codehawk plugins.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.