Error during SS executionjava.lang.NullPointerException: Cannot invoke org.eclipse.jgit.li

  • SonarQube version 9.5, dotnet Scanner,
  • Run a new scan on a C# project
  • tried twice and searched a little bit google
    I had run so many times sonarscanner against a C# project where there is no java as follows

dotnet sonarscanner begin…
dotnet build
dotnet sonarscanner end…

All of a sudden, this afternoon, I needed a new analysis, just to check a new quality gateway I added for code smells, when I run the 3rd step it works until it displays the following error (there is absolutly nothing written in java)

INFO: Sensor C# [csharp] (done) | time=294ms
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=4ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=80ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 1 source file to be analyzed
INFO: SCM Publisher 0/1 source files have been analyzed (done) | time=21ms
INFO: ------------------------------------------------------------------------

ERROR: Error during SonarScanner execution
INFO: Final Memory: 15M/68M
java.lang.NullPointerException: Cannot invoke “org.eclipse.jgit.lib.AnyObjectId.hashCode()” because “id” is null
INFO: ------------------------------------------------------------------------
at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache$Table.index(UnpackedObjectCache.java:115)
at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache$Table.contains(UnpackedObjectCache.java:76)
at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache.isUnpacked(UnpackedObjectCache.java:31)
at org.eclipse.jgit.internal.storage.file.LooseObjects.hasCached(LooseObjects.java:90)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObjectWithoutRestoring(ObjectDirectory.java:353)
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:344)
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:132)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1075)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:985)
at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:101)
at org.sonar.scm.git.CompositeBlameCommand.blame(CompositeBlameCommand.java:72)
at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:84)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:362)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
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(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$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:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
The SonarScanner did not complete successfully
17:23:03.013 Post-processing failed. Exit code: 1

Hey there.

Thanks for the report. Could you try upgrading to SonarQube v9.6 and see if the issue has resolved itself? We updated the version of JGit used, and made some fixes to the git blame implementation.

Do you mean sonarqube server 9.6? if yes, I run sonarqube as follows

/opt/sonarqube/sonarqube-9.5.0.56709/bin/linux-x86-64/sonar.sh console

so if I download this new version, I will lose my projects as well as the tokens used by the sonarscanner, am I correct?

I investigated the directory, I can see a “data” directory where it holds embedded database (H2 Database Engine) named sonar.mv.db. Can I copy this to the new 9.6 directory and then everything should be fine? This a a machine where I do POCs for sonarqube, that is why I use the embedded DB