AmadeusITGroup / sonar-stash

Stash (BitBucket) plugin, a pull-request decorator which allows to integrate SonarQube violations directly into your pull-request
MIT License
165 stars 82 forks source link

Analysis is failing Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Lists #206

Open shobancs opened 4 years ago

shobancs commented 4 years ago

Hi,

Sonarqube server : 6.7.5 LTS Stash plugin : 1.6.0 SonarQube Scanner :2.8

We have the following error for sonar analysis, Can you please let us know what are we missing here Thanks for quick help. 22:25:15 java.lang.IllegalStateException: Fail to instantiate class [org.sonar.plugins.stash.StashPlugin] of plugin [stash] 22:25:15 at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:147) 22:25:15 at org.sonar.core.platform.PluginLoader.load(PluginLoader.java:74) 22:25:15 at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:61) 22:25:15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 22:25:15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 22:25:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 22:25:15 at java.lang.reflect.Method.invoke(Method.java:498) 22:25:15 at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) 22:25:15 at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) 22:25:15 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) 22:25:15 at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) 22:25:15 at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) 22:25:15 at org.picocontainer.behaviors.Stored.start(Stored.java:110) 22:25:15 at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) 22:25:15 at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) 22:25:15 at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) 22:25:15 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134) 22:25:15 at org.sonar.batch.bootstrapper.Batch.doStart(Batch.java:94) 22:25:15 at org.sonar.batch.bootstrapper.Batch.start(Batch.java:88) 22:25:15 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.start(BatchIsolatedLauncher.java:52) 22:25:15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 22:25:15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 22:25:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 22:25:15 at java.lang.reflect.Method.invoke(Method.java:498) 22:25:15 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 22:25:15 at com.sun.proxy.$Proxy0.start(Unknown Source) 22:25:15 at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:220) 22:25:15 at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156) 22:25:15 at org.sonarsource.scanner.cli.Main.execute(Main.java:72) 22:25:15 at org.sonarsource.scanner.cli.Main.main(Main.java:61) 22:25:15 Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Lists 22:25:15 at org.sonar.plugins.stash.StashPlugin.(StashPlugin.java:53) 22:25:15 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 22:25:15 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 22:25:15 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 22:25:15 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 22:25:15 at java.lang.Class.newInstance(Class.java:442) 22:25:15 at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:142) 22:25:15 ... 29 more 22:25:15 Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Lists 22:25:15 at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39) 22:25:15 at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) 22:25:15 at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) 22:25:15 ... 36 more 22:25:15 05:25:15.081 ERROR:

t-8ch commented 4 years ago

sonar-scanner 2.8 is very old. I can't even find it to reproduce the issue. Can you try again with a more recent version of sonar-scanner?

shobancs commented 4 years ago

I switched to sonar-scanner-3.0.3.778 which does not help, I am suspecting if there duplicate jar files are conflicting might be causing to resolve the classes

10:30:59 INFO: Scanner configuration file: /var/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties 10:30:59 INFO: Project root configuration file: NONE 10:31:00 INFO: SonarQube Scanner 3.0.3.778 10:31:00 INFO: Java 1.8.0_77 Oracle Corporation (64-bit) 10:31:00 INFO: Linux 3.10.0-957.el7.x86_64 amd64 10:31:00 INFO: User cache: /var/jenkins/b3_jasper_dev_platform_test_coverage/cache 10:31:02 INFO: Publish mode 10:31:02 INFO: Load global settings 10:31:03 INFO: Load global settings (done) | time=481ms 10:31:03 INFO: Server id: 9B773B46-16fec8299e07457 10:31:03 INFO: User cache: /var/jenkins/b3_jasper_dev_platform_test_coverage/cache 10:31:03 INFO: Load plugins index 10:31:03 INFO: Load plugins index (done) | time=120ms 10:31:05 INFO: ------------------------------------------------------------------------ 10:31:05 INFO: EXECUTION FAILURE 10:31:05 INFO: ------------------------------------------------------------------------ 10:31:05 INFO: Total time: 5.473s 10:31:05 INFO: Final Memory: 60M/240M 10:31:05 INFO: ------------------------------------------------------------------------ 10:31:05 ERROR: Error during SonarQube Scanner execution 10:31:05 java.lang.IllegalStateException: Fail to instantiate class [org.sonar.plugins.stash.StashPlugin] of plugin [stash] 10:31:05 at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:147) 10:31:05 at org.sonar.core.platform.PluginLoader.load(PluginLoader.java:74) 10:31:05 at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:61) 10:31:05 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 10:31:05 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 10:31:05 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 10:31:05 at java.lang.reflect.Method.invoke(Method.java:498) 10:31:05 at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(Reflecti

t-8ch commented 4 years ago

I can't reproduce the issue with the integration test suite and these versions. Duplicate jars should not be the problem. Maybe you can try to run the integration test suite (mvn verify) in your environment and see what happens (adapt the versions in pom.xml). Otherwise there is not much I can do to help.