eclipse 上的 SonarLint:无法启动独立的 SonarLint 引擎
SonarLint on eclipse : Unable to start standalone SonarLint engine
在eclipse上离线安装sonarLint插件后,重启eclipse后报错:
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
完整的日志是:
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonarsource.sonarlint.core.container.ComponentContainer.getComponentByType(ComponentContainer.java:258)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleRepositoryContainer.doAfterStart(StandaloneRuleRepositoryContainer.java:64)
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.standalone.StandaloneGlobalContainer.loadRulesAndActiveRulesFromPlugins(StandaloneGlobalContainer.java:126)
at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.doAfterStart(StandaloneGlobalContainer.java:99)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.start(StandaloneSonarLintEngineImpl.java:64)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.<init>(StandaloneSonarLintEngineImpl.java:52)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.getClient(StandaloneSonarLintClientFacade.java:60)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.runAnalysis(StandaloneSonarLintClientFacade.java:74)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:456)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.runAnalysisAndUpdateMarkers(AnalyzeProjectJob.java:204)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:160)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.runInWorkspace(AbstractSonarProjectJob.java:43)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
at org.picocontainer.injectors.MethodInjector.run(MethodInjector.java:112)
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.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 18 more
Caused by: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because the return value of "javax.script.ScriptEngineManager.getEngineByName(String)" is null
at org.sonarsource.analyzer.commons.JsonParser.<init>(JsonParser.java:36)
at org.sonarsource.analyzer.commons.ProfileDefinitionReader.loadActiveKeysFromJsonProfile(ProfileDefinitionReader.java:59)
at org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(RuleMetadataLoader.java:60)
at org.sonar.plugins.php.PHPRulesDefinition.define(PHPRulesDefinition.java:37)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader.<init>(StandaloneRuleDefinitionsLoader.java:39)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
at org.picocontainer.injectors.ConstructorInjector.run(ConstructorInjector.java:342)
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.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 33 more
Found 0 issue(s)
根据日志,缺少 Java脚本引擎,它包含在较早的 Java 版本中,但 has been removed in Java 15。
确保您的 SonarLint 是最新的。对于离线安装,您可以从 https://binaries.sonarsource.com/SonarLint-for-Eclipse/releases, which is currently, 5.9.0.31414.
获取最新版本
在eclipse上离线安装sonarLint插件后,重启eclipse后报错:
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
完整的日志是:
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonarsource.sonarlint.core.container.ComponentContainer.getComponentByType(ComponentContainer.java:258)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleRepositoryContainer.doAfterStart(StandaloneRuleRepositoryContainer.java:64)
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.standalone.StandaloneGlobalContainer.loadRulesAndActiveRulesFromPlugins(StandaloneGlobalContainer.java:126)
at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.doAfterStart(StandaloneGlobalContainer.java:99)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.start(StandaloneSonarLintEngineImpl.java:64)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.<init>(StandaloneSonarLintEngineImpl.java:52)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.getClient(StandaloneSonarLintClientFacade.java:60)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.runAnalysis(StandaloneSonarLintClientFacade.java:74)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:456)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.runAnalysisAndUpdateMarkers(AnalyzeProjectJob.java:204)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:160)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.runInWorkspace(AbstractSonarProjectJob.java:43)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
at org.picocontainer.injectors.MethodInjector.run(MethodInjector.java:112)
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.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 18 more
Caused by: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because the return value of "javax.script.ScriptEngineManager.getEngineByName(String)" is null
at org.sonarsource.analyzer.commons.JsonParser.<init>(JsonParser.java:36)
at org.sonarsource.analyzer.commons.ProfileDefinitionReader.loadActiveKeysFromJsonProfile(ProfileDefinitionReader.java:59)
at org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(RuleMetadataLoader.java:60)
at org.sonar.plugins.php.PHPRulesDefinition.define(PHPRulesDefinition.java:37)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader.<init>(StandaloneRuleDefinitionsLoader.java:39)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
at org.picocontainer.injectors.ConstructorInjector.run(ConstructorInjector.java:342)
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.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 33 more
Found 0 issue(s)
根据日志,缺少 Java脚本引擎,它包含在较早的 Java 版本中,但 has been removed in Java 15。
确保您的 SonarLint 是最新的。对于离线安装,您可以从 https://binaries.sonarsource.com/SonarLint-for-Eclipse/releases, which is currently, 5.9.0.31414.
获取最新版本