SonarLint analysis failed: Unable to load component class org.sonarsource.sonarlint.core.analyzer.sensor.SensorExecutor

sonarcloud
intellij
(Chris Romack) #1

I get this error when attempting to analyze anything within my Java project (single file/modified files/etc).

My configuration is thus:
IntelliJ Ultimate 2018.1 (build #IU-181.4203.550)
SonarLint for IntelliJ 4.0.2.3009
SonarCloud

I have removed and re-installed the plugin, but continue to receive the error.
Also downgraded to 4.0.1.2990, but continue to receive the error.

Here is the stacktrace from the log tab:

Using configuration of 'customer-services-parent' in server 'SonarCloud'
Analysing 'AbstractCustomerSearchService.java'...
Error running SonarLint analysis
java.lang.IllegalStateException: Unable to load component class org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.getComponentByType(ComponentContainer.java:258)
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:132)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
	at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:82)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:152)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:344)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:334)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:149)
	at org.sonarlint.intellij.core.ConnectedSonarLintFacade.analyze(ConnectedSonarLintFacade.java:71)
	at org.sonarlint.intellij.core.SonarLintFacade.startAnalysis(SonarLintFacade.java:65)
	at org.sonarlint.intellij.analysis.SonarLintAnalyzer.analyzeModule(SonarLintAnalyzer.java:106)
	at org.sonarlint.intellij.analysis.SonarLintTask.analyze(SonarLintTask.java:176)
	at org.sonarlint.intellij.analysis.SonarLintTask.run(SonarLintTask.java:100)
	at org.sonarlint.intellij.analysis.SonarLintUserTask.run(SonarLintUserTask.java:39)
	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$null$1(SonarLintJobManager.java:120)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$2(SonarLintJobManager.java:120)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonarsource.sonarlint.core.analyzer.sensor.DefaultSensorContext
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
	... 29 more
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.ActiveRules
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
	... 43 more
Caused by: java.lang.IllegalStateException: Rule 'cobol:S1135' is already activated
	at org.sonar.api.batch.rule.internal.ActiveRulesBuilder.activate(ActiveRulesBuilder.java:44)
	at org.sonar.api.batch.rule.internal.NewActiveRule.activate(NewActiveRule.java:96)
	at org.sonarsource.sonarlint.core.container.storage.SonarQubeActiveRulesProvider.createNewActiveRule(SonarQubeActiveRulesProvider.java:105)
	at org.sonarsource.sonarlint.core.container.storage.SonarQubeActiveRulesProvider.provide(SonarQubeActiveRulesProvider.java:72)
	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.sonarlint.shaded.org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
	... 57 more
(Julien Henry) #2

Hi @romack

This error usually mean the SonarLint local storage got corrupted. Hard to find the root cause, but you can simply try to open the SonarLint configuration page, and click “Update binding” on the SonarCloud server to fix the issue:

1 Like
(Chris Romack) #3

Julien,

Thank you for your reply. I updated the binding and still receive the error. I even deleted the SonarCloud server and re-added, but still receive the error. If you have any other suggestions on what I should try, please let me know. It is a bummer not being able to lint locally.

Thanks,

Chris

(Chris Romack) #4

I am on macOS Mojave 10.14.4 BTW

(Julien Henry) #5

Strange. Normally updating the binding should clean up everything, but just in case, can you manually remove ~/<.IdeaIXXXXX>/config/sonarlint/storage/ and relaunch the binding update?

(Chris Romack) #6

Julien -

Sorry, I am just now getting back to this. I tried all of your suggestions with no success. My latest attempt was to:

  1. Remove the plugin from IntelliJ and close IntelliJ
  2. Remove any files or directories on my file system with sonar in the name
  3. Re-launch intellij, install and configure the plugin

Analysis still resulted in the error from my original post.

Caused by: java.lang.IllegalStateException: Rule ‘cobol:S1135’ is already activated

I found it interesting that the process consistently failed on the same Cobol rule (even though the project I am attempting to lint is a Java). For grins, I created a custom Cobol Quality Profile, made it the default, deactivated the offending rule and re-ran analysis. This time if failed on a different rule.

Caused by: java.lang.IllegalStateException: Rule ‘cobol:COBOL.ProgramNameCheck’ is already activated

I then removed ALL of the rules from the custom Cobol Quality Profile and was able to successfully analyze my project.

So I think I am good for now, and as I do not think we will be writing any Cobol any time soon at The Container Store, we can probably close this issue.

Just wanted to give you a heads up if anyone else runs into a similar issue.

Regards,

Chris

(Julien Henry) #7

Hi @romack

Would be interesting to put you back in a situation where you can reproduce the issue, and send me the result of the following WS calls:
<sq server>/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=INFO&ps=500
<sq server>/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MINOR&ps=500
<sq server>/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MAJOR&ps=500
<sq server>/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=CRITICAL&ps=500
<sq server>/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=BLOCKER&ps=500

Due to pagination, you may have to run each WS multiple times with parameter &p=x where is is the page number until all results are fetched. That would help me to understand the problem.

(Chris Romack) #8

So for SonarCloud, the URL would be as follows?

https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=INFO&ps=500

I am having trouble deciphering the response from the endpoint above and not exactly clear how to determine when I do or don’t need to paginate. I should just be able to curl and redirect to a file correct?

(Julien Henry) #9

Sorry, I forgot you were on SonarCloud. Is your organization public? If not, any chance you could add my account (julienhenrysonarsource@bitbucket) as a member of your org, so that I could run the queries myself?

(Chris Romack) #10

Julien -

We are setup to sync via GitHub. Could you send me your GitHub user and we will add you to our GitHub.

Thanks,

Chris

(Julien Henry) #11

My GitHub username is henryju.