NullPointerException while collecting changed files in branch

  • sonar-maven-plugin:3.2, SonarQube 7.4.0
  • using sonar maven plugin from Jenkins using jenkins groovy file
  • worked great on this repository till today. Can’t identify a meaningful change that could trigger this.
  • see exception below
[INFO] 10:51:36.997 -------------  Scan ilm-dm-ds-appevent
[DEBUG] 10:51:37.028 Installed core extension: branch-scanner
[INFO] 10:51:37.113 Base dir: /var/lib/jenkins/jobs/ILMDM/jobs/ilm-dm-ds/branches/develop/workspace/ilm-dm-ds-appevent
[INFO] 10:51:37.114 Working dir: /var/lib/jenkins/jobs/ILMDM/jobs/ilm-dm-ds/branches/develop/workspace/ilm-dm-ds-appevent/target/sonar
[INFO] 10:51:37.115 Source paths: pom.xml, src/main/java
[INFO] 10:51:37.115 Test paths: src/test/java
[INFO] 10:51:37.116 Source encoding: UTF-8, default locale: en_US
[INFO] 10:51:37.117 SCM collecting changed files in the branch
[DEBUG] 10:51:37.130 readpipe [git, --version],/bin
[DEBUG] 10:51:37.138 readpipe may return 'git version 2.16.5'
[DEBUG] 10:51:37.138 remaining output:

[DEBUG] 10:51:37.138 readpipe [git, config, --system, --edit],/bin
[DEBUG] 10:51:37.141 readpipe may return '/etc/gitconfig'
[DEBUG] 10:51:37.141 remaining output:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project ilm-dm-ds-parent: Unable to load component class org.sonar.scanner.phases.AbstractPhaseExecutor: Unable to load component class org.sonar.scanner.phases.PostJobsExecutor: Unable to load component class org.sonar.scanner.bootstrap.ScannerExtensionDictionnary: Unable to load component class org.sonar.scanner.sensor.DefaultSensorContext: Unable to load component class org.sonar.scanner.scan.filesystem.DefaultModuleFileSystem: Unable to load component class org.sonar.scanner.scan.filesystem.StatusDetection: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project ilm-dm-ds-parent: 
----- truncated stacktrace due to post limit ------
Caused by: java.lang.NullPointerException
    at org.eclipse.jgit.lib.ObjectIdOwnerMap.get (ObjectIdOwnerMap.java:138)
    at org.eclipse.jgit.revwalk.RevWalk.parseAny (RevWalk.java:888)
    at org.eclipse.jgit.revwalk.RevWalk.parseCommit (RevWalk.java:800)
    at org.sonarsource.scm.git.GitScmProvider.prepareTreeParser (GitScmProvider.java:196)
    at org.sonarsource.scm.git.GitScmProvider.branchChangedFiles (GitScmProvider.java:90)
    at org.sonar.scanner.scm.ScmChangedFilesProvider.loadChangedFilesIfNeeded (ScmChangedFilesProvider.java:70)
    at org.sonar.scanner.scm.ScmChangedFilesProvider.provide (ScmChangedFilesProvider.java:50)
    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.picocontainer.injectors.MethodInjector.invokeMethod (MethodInjector.java:129)
    at org.picocontainer.injectors.MethodInjector.access$000 (MethodInjector.java:39)
    at org.picocontainer.injectors.MethodInjector$2.run (MethodInjector.java:113)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.MethodInjector.decorateComponentInstance (MethodInjector.java:120)
    at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance (CompositeInjector.java:58)
    at org.picocontainer.injectors.Reinjector.reinject (Reinjector.java:142)
    at org.picocontainer.injectors.ProviderAdapter.getComponentInstance (ProviderAdapter.java:96)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:621)
    at org.picocontainer.containers.ImmutablePicoContainer.getComponent (ImmutablePicoContainer.java:40)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:718)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance (BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance (ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter (SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments (ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run (ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe (AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance (ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance (AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance (AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance (Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance (DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:63)
    at org.picocontainer.DefaultPicoContainer.getComponent (DefaultPicoContainer.java:678)
    at org.sonar.core.platform.ComponentContainer.getComponentByType (ComponentContainer.java:281)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart (ModuleScanContainer.java:164)
    at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan (ProjectScanContainer.java:319)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:314)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:312)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:288)
    at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
    at org.sonar.scanner.task.ScanTask.execute (ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart (TaskContainer.java:82)
    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.executeTask (GlobalContainer.java:131)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask (Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.executeTask (Batch.java:111)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:62)
    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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy23.execute (Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis (EmbeddedScanner.java:151)
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:78)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:122)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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.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)
1 Like

I too have the same error. Could perhaps be configuration problem, but the error doesn’t inform what the problem could be.

Hi guys,

I wonder if you could try upgrading & testing to see if the error persists. The current version is 7.6.

 
Ann

Apologies. I have this same error with sonarcloud, not not sonarqube.

I tried to reproduce it locally, but without success. It seems is related somehow to Jenkins.

Jenkins is just invoking maven. I see no reason why it should be Jenkins.

Hi,

The difference is going to be in your checkout, not in your build.

 
Ann

That’s what I meant: that Jenkins is doing the checkout differently.
After seeing this post I noticed that GIT_COMMIT was null and tried to set it as suggested. But the error is the same…
I’ll try to upgrade to 7.6 as a last resort.

I have the same issue running sonarcloud and Jenkins 2.165 with latest sonar scanner plugin 2.8.1

We did not change any settings and it started yesterday out of nowhere.

Solved.
In my case it was because of the “shallow clone” feature enabled on Jenkins.

1 Like