2

My environment is the following:

http://localhost:9000/sonar/api/server/version :: 5.2
java,sonar-java-plugin-3.7.jar|07dba2b9cad37584d82522414b2dccd0
scmgit,sonar-scm-git-plugin-1.0.jar|e1d9d8e1d3524f9f0f69017e6dbead02
scmsvn,sonar-scm-svn-plugin-1.2.jar|188d526ad86ec7f2dc7de694bf5f1851

printenv | grep MAVEN<BR>
MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512m

I launch the command:

mvn sonar:sonar -Dsonar.verbose=true

and it fails as reported here below.

If I insert the file MyFileName.java (ref. backtrace) in the SonarQube Global Source File Exclusions, then the process goes ahead, up to a next file (likely to a next file that needs to be traced because it's affected by some issue) and it fails again with the same symptoms.

There's no specific trace in the sonar.log file.

Same results with:

mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar -Dsonar.verbose=true

The main project I'm trying to analyse is very wide and the "module" that is failing is the 103rd one; this is only to say that there are several modules already processed in the previous stages without any sonar failures.

Any suggestions on how I could investigate this issue?

Backtrace:

....
[INFO] -------------  Scan My103thModule
[INFO] Language is forced to java
[INFO] Base dir: /bla/bla/bla
[INFO] Working dir: /bla/bla/bla/target/sonar
[INFO] Source paths: pom.xml, src/main/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] JaCoCoSensor: JaCoCo report not found.
[INFO] JaCoCoItSensor: JaCoCo IT report not found.
[INFO] JaCoCoOverallSensor: JaCoCo reports not found.
[INFO] Sensor JavaSquidSensor
[INFO] Java Main Files AST scan...
[INFO] 1 source files to be analyzed
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[....] 
[INFO] BUILD FAILURE
[....]
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project mlwc.project: SonarQube is unable to analyze file : ' ..../MyFileName.java': NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project mlwc.project: SonarQube is unable to analyze file : ' ..../MyFileName.java'
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: SonarQube is unable to analyze file : ' ..../MyFileName.java'
    at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:104)
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:135)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '..../MyFileName.java'
    at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:105)
    at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:77)
    at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:130)
    at org.sonar.java.JavaSquid.scan(JavaSquid.java:123)
    at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:90)
    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.PhaseExecutor.execute(PhaseExecutor.java:98)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:251)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:251)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
    at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
    at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
    at com.sun.proxy.$Proxy21.execute(Unknown Source)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:275)
    at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:166)
    at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:153)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:99)
    ... 22 more
Caused by: java.lang.NullPointerException
    at org.sonar.batch.source.SymbolizableBuilder.loadPerspective(SymbolizableBuilder.java:46)
    at org.sonar.batch.source.SymbolizableBuilder.loadPerspective(SymbolizableBuilder.java:32)
    at org.sonar.batch.deprecated.perspectives.BatchPerspectives.as(BatchPerspectives.java:63)
    at org.sonar.java.SonarComponents.symbolizableFor(SonarComponents.java:111)
    at org.sonar.java.model.InternalVisitorsBridge.createSonarSymbolTable(InternalVisitorsBridge.java:170)
    at org.sonar.java.model.InternalVisitorsBridge.visitFile(InternalVisitorsBridge.java:104)
    at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:97)
    ... 52 more
helencrump
  • 1,351
  • 1
  • 18
  • 27
railnet
  • 21
  • 4

1 Answers1

0

I also had this issue and found that upgrading (from 5.2) to SonarQube 5.3 resolved it. This suggests that the issue is related to a bug with 5.2 however I have not been able to track down the specific fix. I'll update this answer with a link to the Jira if I find it

kceeeeee
  • 63
  • 1
  • 5