Error: Unable to register extension com.sonar.security.frontend.python.A from plugin 'securitypython

Hi,

We’re using the SonarCloud analyzer (SonarScanner) during our C# CI builds on Azure DevOps in our private repositories. Since this morning the analyzer (SonarCloudAnalyze@1) is throwing an exception on multiple different CI builds. Here’s the stacktrace:

> ERROR: Error during SonarScanner execution
> ##[error]java.lang.IllegalStateException: Unable to register extension com.sonar.security.frontend.python.A from plugin 'securitypythonfrontend'
> ##[error]ERROR: Error during SonarScanner execution
> java.lang.IllegalStateException: Unable to register extension com.sonar.security.frontend.python.A from plugin 'securitypythonfrontend'
> ##[error]at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:234)
> 	at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:234)
> ##[error]at org.sonar.scanner.bootstrap.ExtensionInstaller.doInstall(ExtensionInstaller.java:55)
> rap.ExtensionInstaller.install(ExtensionInstaller.java:46)
> 	at org.sonar.scanner.bootstrap.ExtensionInstaller.doInstall(ExtensionInstaller.java:55)
> 	at org.sonar.scanner.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:46)
> ##[error]at org.sonar.scanner.scan.ModuleScanContainer.addExtensions(ModuleScanContainer.java:59)
> 	at org.sonar.scanner.scan.ModuleScanContainer.addExtensions(ModuleScanContainer.java:59)
> ##[error]at org.sonar.scanner.scan.ModuleScanContainer.doBeforeStart(ModuleScanContainer.java:34)
> 	at org.sonar.scanner.scan.ModuleScanContainer.doBeforeStart(ModuleScanContainer.java:34)
> ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:121)
> 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:121)
> ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
> rojectScanContainer.scanRecursively(ProjectScanContainer.java:464)
> 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
> 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:464)
> ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:461)
> 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:461)
> ##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
> 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
> ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
> 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
> ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> ##[error]at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
> ComponentContainer.startComponents(ComponentContainer.java:123)
> 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
> 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
> ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
> ##[error]at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
> 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
> ##[error]at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
> 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
> ##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
> 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
> ##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ##[error]at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ##[error]at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
> 	at com.sun.proxy.$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:126)
> 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
> 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
> Caused by: java.lang.NoClassDefFoundError: org/sonar/sslr/grammar/GrammarRuleKey
> 	at java.base/java.lang.Class.getDeclaredFields0(Native Method)
> 	at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
> 	at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
> 	at org.picocontainer.injectors.AdaptingInjection$2.run(AdaptingInjection.java:217)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at org.picocontainer.injectors.AdaptingInjection.injectionFieldAnnotated(AdaptingInjection.java:209)
> 	at org.picocontainer.injectors.AdaptingInjection.fieldAnnotatedInjectionAdapter(AdaptingInjection.java:188)
> 	at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:57)
> 	at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44)
> 	at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptInCaching.java:45)
> 	at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536)
> 	at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContainer.java:84)
> 	at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1149)
> 	at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:232)
> 	... 29 more
> Caused by: java.lang.ClassNotFoundException: org.sonar.sslr.grammar.GrammarRuleKey
> 	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
> 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
> 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
> 	... 43 more
> ERROR:
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
> 	at com.sun.proxy.$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:126)
> 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
> 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
> Caused by: java.lang.NoClassDefFoundError: org/sonar/sslr/grammar/GrammarRuleKey
> 	at java.base/java.lang.Class.getDeclaredFields0(Native Method)
> 	at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
> 	at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
> 	at org.picocontainer.injectors.AdaptingInjection$2.run(AdaptingInjection.java:217)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at org.picocontainer.injectors.AdaptingInjection.injectionFieldAnnotated(AdaptingInjection.java:209)
> 	at org.picocontainer.injectors.AdaptingInjection.fieldAnnotatedInjectionAdapter(AdaptingInjection.java:188)
> 	at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:57)
> 	at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44)
> 	at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptInCaching.java:45)
> 	at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536)
> 	at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContainer.java:84)
> 	at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1149)
> 	at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:232)
> 	... 29 more
> Caused by: java.lang.ClassNotFoundException: org.sonar.sslr.grammar.GrammarRuleKey
> 	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
> 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
> 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
> 	... 43 more
> ERROR: 
> ##[error]The SonarScanner did not complete successfully
> The SonarScanner did not complete successfully
> ##[error]10:44:47.999  Post-processing failed. Exit code: 1
> 10:44:47.999  Post-processing failed. Exit code: 1

We currently don’t have a workaround in place, so this issue is blocking our CI builds.

Any help and/or suggestions on how to resolve this issue, is appreciated!

Thank you in advance.

^Patrick Vroegh

3 Likes

We are seeing the same error and it’s blocking all .NET analyzers. Can we get this fixed ASAP?

1 Like

We’ve noticed that emptying the cache in C:\Users\<sonaruser>\.sonar resolves this issue. We’ll keep an eye out if this happens more often, then we might schedule cleaning of the cache.

It would be interesting to know what exactly causes this.

Hi,

Sorry this thread got overlooked. Are you still experiencing this?

 
Ann

Hi there!

Yes, we’re still experiencing this issue and for know we just disabled SonarCloud all together to at least get our builds succeeding again.

Thanks in advance for looking into this!

Cheers,
Patrick Vroegh

1 Like

A workaround we have discovered is to delete the build user’s Sonar cache in: C:\Users\<build user>\.sonar\cache

1 Like

Hi,

Thanks y’all for both confirmation that the problem still exists and for the workaround. I’ve flagged this for the team.

 
Ann

Hello,

I’m investigating your issue.

Do you know when this issue started to happen for you ? Is it 24th of February when you opened that ticket ? Or is it before ?

Can you share the full scanner logs by private message with me, it might help me understand what happens there.

And one last question, where is the cache that you are emptying located ? Is it in your Azure devops pipeline, or, as the path suggest, on some local machine on your side ?
In case of the cache being removed on your local, have you tried removing the cache in your Azure Devops pipeline that is doing the analysis ?

Thanks for all your answers,

Quentin

Hi Quentin,

Today this happened again. I will share the logs with you in a private message.
The cache that we empty to fix it, is located on our on-prem buildserver. How would you suggest removing the cache of the Azure pipeline?

Hello,

Sorry for the delay in reply, the issue seems quite tricky.
I found this related thread, while I am still looking for the solution, you can try to disable the cache as suggested in the thread, and we will update you with more info soon.

Best regards,

Hey there, I’m looking at this issue.

If it happens again, or if you can reproduce the issue, could you please:

1/ Give me the full Scanner logs with debug mode enabled, to gather more information

2/ Post here the list of all the content (including sub-dirs) of the Sonar Cache directory, with permission information
You can find the cache path in the Scanner logs, it looks like this:

INFO: User cache: C:\some\path\to\.sonar\cache

3/ Check if the user running the SonarScanner command has permission to read, write and execute all the files into the cache directory and its subdirectories. A similar issue was solved by fixing some permissions, and I would like to confirm if it could be the same issue or not.

Cleaning the cache directory should unblock the build, as the packages will be downloaded again from SonarCloud. The scan will be slower though, that’s why I won’t count it as a long-term solution but only as a workaround.

Best,
Claire

Hi Claire, thanks for your efforts. Sorry it took a while, but here are the logs on both an export of the folder permission for the service account running the job, as well als de SonarCloud Analyze task itself. Let me know if this is what you are looking for, or if you need more information.

12_PowerShell.txt (74.4 KB)
13_SonarCloud analyze.txt (66.1 KB)