Sonar Scanner null pointer error while run sonar-scanner.bat file - java

I am getting null pointer exception after executing sonar-scanner.bat file in windows terminal for java mutliple application. I added path in sonar-scanner
INFO: EXECUTION FAILURE INFO:
------------------------------------------------------------------------ INFO: Total time: 25.283s INFO: Final Memory: 15M/57M INFO:
------------------------------------------------------------------------ ERROR: Error during SonarScanner execution
java.lang.NullPointerException
at org.sonarsource.scm.git.GitScmProviderBefore77.revisionId(GitScmProviderBefore77.java:173)
at org.sonar.scanner.scm.ScmRevisionImpl.get(ScmRevisionImpl.java:62)
at org.sonar.scanner.report.MetadataPublisher.addScmInformation(MetadataPublisher.java:153)
at org.sonar.scanner.report.MetadataPublisher.publish(MetadataPublisher.java:105)
at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:152)
at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:138)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:366)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62) ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug
logging.
I am using below given version of sonarqube and sonarscanner.
sonarqube-7.8
sonar-scanner-cli-4.8.0.2856-windows
I am trying to get the testing report for my application in SonarQube(localhost :9000).
Any help is appreciated, and if there is more information needed I will provide it.
Thanks.

The scanner fails if it can’t find a HEAD reference when running a scan with git. Can you try commit something and try this again? Alternatively, if there is no HEAD, just specify -Dsonar.scm.disabled=true.
Source: https://community.sonarsource.com/t/nullpointerexception-when-running-scan/15598/4

Related

Quarkus cannot find valid Docker environment for databases

When I put quarkus.datasource.db-kind to either derby or h2, quarkusDev runs fine.
However, when I try putting quarkus.datasource.db-kind to db2 (tried postgresql with the same result) I get the following error:
java.lang.IllegalStateException: Could not find a valid Docker Environment.
I'm assuming that quarkus is trying to fetch a docker container for starting the database, but cannot find it. It does occurs a bit strange to be that quarkus is trying to start a database in quarkusDev-mode, but anyways.
Does anyone know how to solve this problem?
Error:
2021-06-23 10:59:21,159 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor#launchDatabases threw an exception: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at io.quarkus.devservices.db2.deployment.DB2DevServicesProcessor$1.startDatabase(DB2DevServicesProcessor.java:31)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:217)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:103)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:396)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:269)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:79)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:378)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:127)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:144)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor#launchDatabases threw an exception: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at io.quarkus.devservices.db2.deployment.DB2DevServicesProcessor$1.startDatabase(DB2DevServicesProcessor.java:31)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:217)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:103)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:153)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:394)
... 9 more
Caused by: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at io.quarkus.devservices.db2.deployment.DB2DevServicesProcessor$1.startDatabase(DB2DevServicesProcessor.java:31)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:217)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:103)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
applications.properties (located in main)
quarkus.datasource.db-kind = db2
quarkus.datasource.username = testdb
quarkus.datasource.password = testdb
quarkus.hibernate-orm.database.generation = update
gradle.properties:
#Gradle properties
#Wed Jun 23 10:41:16 CEST 2021
quarkusPluginVersion=1.13.2.Final
quarkusPlatformArtifactId=quarkus-universe-bom
quarkusPluginId=io.quarkus
quarkusPlatformGroupId=io.quarkus
//\#=-*- coding\: utf-8 -*-
systemProp.org.gradle.internal.publish.checksums.insecure=true
org.gradle.logging.level=INFO
org.gradle.jvmargs=-Xmx4096m
version=1.0.0-SNAPSHOT
quarkusPlatformVersion=1.13.2.Final
What you are seeing is Quarkus attempting to launch a container to run the database because you have not specified a quarkus.datasource.jdbc.url.
This feature is called DevServices and you find more information about it here.
This feature essentially kicks in in dev and test modes when you have not specified the database to be used.
You can explicitly run it off using quarkus.datasource.devservices.enabled=false or by setting quarkus.datasource.jdbc.url to a URL of a running database

Error When Installing Eclipse IDE for Enterprise Java Developers

So I've been trying to install eclipse and whenever I run the installer, select Eclipse IDE for Enterprise Java Developers, and click install, I get an error message:
[2020-11-14 14:18:04] An error was detected while performing the engine operation and the changes are being rolled back. See the log for details.
[2020-11-14 14:18:04] ERROR: org.eclipse.equinox.p2.engine code=4 An error occurred during the org.eclipse.equinox.internal.p2.engine.phases.CheckTrust phase.
at org.eclipse.oomph.util.OomphPlugin.coreException(OomphPlugin.java:291)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl$3.commit(ProfileTransactionImpl.java:551)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl.commit(ProfileTransactionImpl.java:343)
at org.eclipse.oomph.setup.p2.impl.P2TaskImpl.perform(P2TaskImpl.java:899)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.doPerformNeededSetupTasks(SetupTaskPerformer.java:3828)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performNeededSetupTasks(SetupTaskPerformer.java:3756)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performTriggeredSetupTasks(SetupTaskPerformer.java:3737)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.perform(SetupTaskPerformer.java:3630)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.installPerform(SimpleVariablePage.java:1343)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.access$33(SimpleVariablePage.java:1211)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage$20.run(SimpleVariablePage.java:1156)
ERROR: org.eclipse.equinox.p2.engine code=0 session context was:(profile=C__Users_Joachim_eclipse_jee-2020-09_eclipse, phase=org.eclipse.equinox.internal.p2.engine.phases.CheckTrust, operand=, action=).
ERROR: org.eclipse.equinox.p2.engine code=0 Error reading signed content.
java.io.IOException: Exception in opening zip file: C:\Users\Joachim\.p2\pool\plugins\org.eclipse.buildship.branding_3.1.4.v20200326-1743.jar
at org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:353)
at org.eclipse.osgi.internal.signedcontent.SignedBundleHook.getSignedContent(SignedBundleHook.java:217)
at org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker.checkCertificates(CertificateChecker.java:77)
at org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker.start(CertificateChecker.java:58)
at org.eclipse.equinox.internal.p2.engine.phases.CheckTrust.completePhase(CheckTrust.java:55)
at org.eclipse.equinox.internal.p2.engine.Phase.postPerform(Phase.java:254)
at org.eclipse.equinox.internal.p2.engine.Phase.perform(Phase.java:105)
at org.eclipse.equinox.internal.p2.engine.PhaseSet.perform(PhaseSet.java:50)
at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:80)
at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:48)
at org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper.executePlan(PlanExecutionHelper.java:46)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl$3.commit(ProfileTransactionImpl.java:547)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl.commit(ProfileTransactionImpl.java:343)
at org.eclipse.oomph.setup.p2.impl.P2TaskImpl.perform(P2TaskImpl.java:899)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.doPerformNeededSetupTasks(SetupTaskPerformer.java:3828)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performNeededSetupTasks(SetupTaskPerformer.java:3756)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performTriggeredSetupTasks(SetupTaskPerformer.java:3737)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.perform(SetupTaskPerformer.java:3630)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.installPerform(SimpleVariablePage.java:1343)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.access$33(SimpleVariablePage.java:1211)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage$20.run(SimpleVariablePage.java:1156)
Caused by: java.nio.file.NoSuchFileException: C:\Users\Joachim\.p2\pool\plugins\org.eclipse.buildship.branding_3.1.4.v20200326-1743.jar
at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)
at java.base/java.nio.file.Files.readAttributes(Unknown Source)
at java.base/java.util.zip.ZipFile$Source.get(Unknown Source)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(Unknown Source)
at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
at org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:335)
at org.eclipse.osgi.internal.signedcontent.SignedBundleHook.getSignedContent(SignedBundleHook.java:217)
at org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker.checkCertificates(CertificateChecker.java:77)
at org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker.start(CertificateChecker.java:58)
at org.eclipse.equinox.internal.p2.engine.phases.CheckTrust.completePhase(CheckTrust.java:55)
at org.eclipse.equinox.internal.p2.engine.Phase.postPerform(Phase.java:254)
at org.eclipse.equinox.internal.p2.engine.Phase.perform(Phase.java:105)
at org.eclipse.equinox.internal.p2.engine.PhaseSet.perform(PhaseSet.java:50)
at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:80)
at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:48)
at org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper.executePlan(PlanExecutionHelper.java:46)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl$3.commit(ProfileTransactionImpl.java:547)
at org.eclipse.oomph.p2.internal.core.ProfileTransactionImpl.commit(ProfileTransactionImpl.java:343)
at org.eclipse.oomph.setup.p2.impl.P2TaskImpl.perform(P2TaskImpl.java:899)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.doPerformNeededSetupTasks(SetupTaskPerformer.java:3828)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performNeededSetupTasks(SetupTaskPerformer.java:3756)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performTriggeredSetupTasks(SetupTaskPerformer.java:3737)
at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.perform(SetupTaskPerformer.java:3630)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.installPerform(SimpleVariablePage.java:1343)
at org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.access$33(SimpleVariablePage.java:1211)
... 1 more
I've already tried disabling mirror but it still didn't work.
If anyone could tell me what's going on and how I could fix the issue, I would really appreciate it. Thanks!
Check the below things:
JAVA_HOME path is correct:
C:\Program Files\Java\jdk1.8.0_***
System variables are correct:
C:\Program Files\Java\jdk1.8.0_***\bin
C:\Program Files\Java\jre1.8.0_***\bin
This was the issue with me. I re-checked and fixed my mistake.

Sonar Runner execution error on IssueListener?

I have a job that I run on a monthly basis at this time. Lately, I'm encounting an Issue that I don't get when running sonar-runner (version 2.5.1):
INFO: Scanner configuration file:
/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_Scanner_2.5.1/conf/sonar-runner.properties
INFO: Project configuration file:
/var/lib/jenkins/workspace/tpk-extra-package/tpx-extra-tools/tpk-extra-tools_build/sonar-project.properties
INFO: SonarQube Scanner 2.5.1 INFO: Java 1.8.0_121 Oracle Corporation
(64-bit) INFO: Linux 4.4.0-98-generic amd64 INFO: Error stacktraces
are turned on. INFO: User cache: /var/lib/jenkins/.sonar/cache
Exception in thread "main" java.lang.NoClassDefFoundError:
org/sonar/batch/bootstrapper/IssueListener at
org.sonar.runner.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:44)
at
org.sonar.runner.batch.BatchIsolatedLauncher.start(BatchIsolatedLauncher.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy0.start(Unknown Source) at
org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:251)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:187)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:182)
at org.sonarsource.scanner.cli.Main.execute(Main.java:76) at
org.sonarsource.scanner.cli.Main.main(Main.java:66) Caused by:
java.lang.ClassNotFoundException:
org.sonar.batch.bootstrapper.IssueListener at
java.net.URLClassLoader.findClass(URLClassLoader.java:381) at
org.sonar.runner.impl.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
The host where I run this command did not change over the last month (since the last successful run): same kernel, same java 1.8 version, ...
I've checked using strace/ltrace but couldn't find what is the issue.
I try to run the same sonar-runner on a different system (another linux distro with different kernel and java - but yet 1.8), still the same stacktrace.
Do you have any idea ?
Thanks for your help.

SonarQube is unable to analyze file : Java file

org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file a Java file
I am using SonarQube version 5.6.1
These are my properties and I have using Java 8:
sonar.projectKey=Project1
sonar.projectName=ProProject
sonar.projectVersion=Layer1
sonar.verbose=true
sonar.sources=src
sonar.qualitygate=SonarQube way
sonar.libraries=lib
sonar.tests=Tests
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
sonar.analysis.mode=publish
sonar.issuesReport.console.enable=true
sonar.sourceEncoding=UTF-8
During my sonarQube Analysis I am getting a error like this in my java code.
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(AccessController.java:594)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '/application/scanner/jenkins/workspace/Test/src/Cases/address/PerAddress.java'
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93)
at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:133)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:126)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:93)
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
at org.sonar.java.se.ProgramState.decreaseReference(ProgramState.java:212)
at org.sonar.java.se.ProgramState.cleanupDeadSymbols(ProgramState.java:256)
at org.sonar.java.se.ExplodedGraphWalker.cleanUpProgramState(ExplodedGraphWalker.java:241)
at org.sonar.java.se.ExplodedGraphWalker.handleBlockExit(ExplodedGraphWalker.java:249)
at org.sonar.java.se.ExplodedGraphWalker.execute(ExplodedGraphWalker.java:199)
at org.sonar.java.se.ExplodedGraphWalker.visitMethod(ExplodedGraphWalker.java:152)
at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218)
at org.sonar.java.se.SymbolicExecutionVisitor.visitNode(SymbolicExecutionVisitor.java:49)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:95)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
at org.sonar.java.ast.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:78)
at org.sonar.java.ast.visitors.SubscriptionVisitor.scanFile(SubscriptionVisitor.java:64)
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:120)
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:84)
... 39 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Execute SonarQube Scanner' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: FAILURE
Is there anything I missed out
May have been answered in SonarQube is unable to analyze file (NullPointerException), depending on the version of sonar-java plugin you are using.

SonarQube - strange OutOfMemoryError: PermGen space

I know that there are similar questions out here, but none seems to provide a solution, so I hope that my setting is somewhat different, so that there may be a solution at least for this specific problem:
For some reasons we are stuck to SonarQube 4.5.6 at the moment, trying to analyse a huge Java project (12.000 files with about 1.000.000 lines of code). The rule set consists of about 700 rules spread over the java-plugin (latest version 3.11), findbugs (latest version 3.3), checkstyle (need to use an older version here - 2.2, cause of some rules not available in later versions), and pmd (latest version 2.5).
With Sonar Runner 2.4 the parts of java-plugin, findbugs (with a timeout set to about 20 minutes), checkstyle run through, but within pmd I keep getting an OutOfMemoryError: PermGen space
17:56:31.276 INFO - Sensor PmdSensor...
17:56:31.279 INFO - Execute PMD 5.4.0...
17:56:31.313 INFO - Java version: 1.5
17:56:31.360 INFO - PMD configuration: C:\src\.\.sonar\pmd.xml
17:57:23.679 INFO - Execute PMD 5.4.0 done: 52400 ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 57:33.538s
Final Memory: 47M/3908M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.sourceforge.pmd.lang.java.typeresolution.PMDASMClassLoader.loadClass(PMDASMClassLoader.java:65)
at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.populateType(ClassTypeResolver.java:655)
at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:179)
at net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration.jjtAccept(ASTImportDeclaration.java:62)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:55)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:9)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:136)
at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:170)
at net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit.jjtAccept(ASTCompilationUnit.java:42)
at net.sourceforge.pmd.lang.java.typeresolution.TypeResolutionFacade.initializeWith(TypeResolutionFacade.java:17)
at net.sourceforge.pmd.lang.java.AbstractJavaHandler$5.start(AbstractJavaHandler.java:88)
at net.sourceforge.pmd.SourceCodeProcessor.usesTypeResolution(SourceCodeProcessor.java:127)
at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:142)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:76)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:43)
at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:82)
at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:120)
at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:90)
at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:75)
at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:67)
The stack trace says I'm still in pmd, but the pmd seems to have already been through analysis (line Execute PMD 5.4.0 done: ...), and there shouldn't be another plug-in running thereafter. Nevertheless, I wonder where I should increase the PermGen space ... I already have
wrapper.java.additional.2=-XX:MaxPermSize=8g
wrapper.java.maxmemory=8g
in wrapper.conf and also tried to add
set JAVA_OPTS="-XX:PermSize=256m -XX:MaxPermSize=4096m"
in sonar-runner.bat. In addition there's
sonar.web.javaOpts=-server -Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
in sonar.properties. First, I don't understand which setting is the one responsible for the OutOfMemoryError - the one in wrapper.conf? the one in sonar-runner.bat? or sonar.properties?
What can I do when PermSize of 8g isn't helping?? The default size is 128m or something, so it's already a factor of 64!?
Any idea, how to analyse this project with SonarQube? The problem occurs as well with the built-in database as with a MySQL, so I don't think that that has any influence.
Any help appreciated. Thanks ... if you need any more info about configuration or have an idea to get some more infos out of some logs, please let me know.
You need to allocate the extra memory not on the server side, but on the analysis side to the process that runs the analysis. Since you appear to be analyzing using the SonarQube Scanner, I'll direct you to the Troubleshooting section of those docs, where it tells you how to adjust the memory settings for the process by exporting a SONAR_RUNNER_OPTS env var.

Categories

Resources