That’s strange, the stacktrace seems truncated. Could you please run the build with debug variable set to true, maybe it will reveal the root cause.
I’m interested by what should come after:
2019-02-14T01:25:36.1934256Z ERROR: Caused by: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
2019-02-14T01:25:36.1934308Z ERROR:
Anyway the error seems related to our integration with SCM (you are using Git I presume).
Hi, We’ve recently encountered the same issue, and may be able to provide some further details:
We’ve just upgraded our SQ version, we’re now using 7.6 Developer.
The issue has come to light as it’s triggered during branch analysis which we couldn’t use prior to getting a Developer license.
When running an Azure Devops build pipeline, we have a maven step using validate as the goal, and are calling for sonarqube to run as part of this build step.
Greater detail from the last couple of errors in the stack trace:
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
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)
... 85 more
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)
Versions are Sonarqube Developer 7.6
Used scanner sonar-maven-plugin with both versions 3.4.0.905 & 3.6.0.1398
Of note is if I attempt to run this locally I get a different error, stack trace is the same until the last few stages as it’s still an issue in GitScmProvider. I’ll post that stack trace in a follow up post.
Also if another member of my team runs this locally, it passes for him, so I suspect it’s not inherently a sonarqube server setup/configuration issue.
Continuing from above, the stack trace from the error when run on my local machine is:
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent (ComponentContainer.java:65)
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)
Caused by: java.lang.IllegalArgumentException: Invalid value: diff.algorithm=patience
at org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum (DefaultTypedConfigGetter.java:138)
at org.eclipse.jgit.lib.Config.getEnum (Config.java:373)
at org.eclipse.jgit.diff.DiffFormatter.setReader (DiffFormatter.java:212)
at org.eclipse.jgit.diff.DiffFormatter.setRepository (DiffFormatter.java:180)
at org.eclipse.jgit.api.DiffCommand.call (DiffCommand.java:124)
at org.sonarsource.scm.git.GitScmProvider.branchChangedFiles (GitScmProvider.java:92)
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)
Locally it’s also been run with sonar-maven-plugin 3.4.0.905 & 3.6.0.1398 as well as earlier versions I can’t remember right now.
Both the machine running the the build in the cloud and my local machine have java 1.8
I’ve used both maven 3.6 & 3.3.9 locally
I also created a new project to run this against with no dependencies and only the sonar-maven-plugin and the error still occurs locally, not tested in azure pipeline.
We also have a separate project that uses gradle which has no problems when running a branch analysis.
Thanks for the swift reply Julien, it’s greatly appreciated.
Removing the diff.algorithm=patience did fix the problem on my local machine.
However, the other issue with regards to it failing when running in an Azure Devops Pipeline (see my first post on this topic, rather than my follow-up) which does seem to match the original error on this topic is still present. If you’d rather not have them associated I’m happy to move that one to it’s own topic.
Further update, the empty project passes build analysis fine in azure. I’m wondering if it’s possible that there could be some mismatch in versions for a transitive dependency.
Having the same issue. Everything works for the master branch, other than that the coda analysis step fails right after:
SCM collecting changed files in the branch
Did you make sure, that you make a full checkout of the code before running branch analysis. E.g. if you use git none of this parameter --depth, --shallow-since, --shallow-exclude, --shallow-submodules should be used when checking out the code.
Yes, I had made full check outs.
In the meantime, I found out that I needed to create the project in SonarCloud first, and specify in Administration->Branches&Pull Requests which branches to work with prior to running the pipeline in Azure. Otherwise only the master branch gets analysed and its results published. Kudos to my colleague YL.
Hello @budzow. We are running into same issue. However, we cannot do an entire clone. We have to stick to a shallow clone. Is there any workaround in our case?