sonar-runner获取java.lang.ClassNotFoundException:org.picocontainer.Startable

时间:2015-11-20 15:43:47

标签: sonarqube sonar-runner

我将测试Sonar服务器升级到5.2并使用sonar-runner-2.5-RC1并且没有任何问题运行sonar-runner来分析我的代码。然后我将生产的Sonar服务器升级到5.2并使用相同的命令行设置和sonar-runner.properties文件运行生产版本,我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/picocontainer/Startable

然后我在我的'test'构建机器上运行构建对生产声纳服务器并且它正确运行。所以在我看来,生产构建机器必然存在一些影响声纳 - 跑步者的差异,但我无法弄清楚问题可能是什么。

我在声纳跑步者属性文件中的所有内容是:

sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.modules=svc1, \
  svc2

svc1.sonar.java.binaries=../build/gradle/svc1/classes/
svc1.sonar.projectName=SVC1

svc2.sonar.java.binaries=../build/gradle/svc2/classes/
svc2.sonar.projectName=SVC2

cli.sonar.language=py
cli.sonar.projectName=CLI
SONAR_RUNNER_OPTS='-Xmx2048m -XX:MaxPermSize=512m' sonar-runner-2.5-RC1/bin/sonar-runner
 -e
 -Dproject.settings=/workspace/build/workspace/sonar-runner.properties
 -Dsonar.host.url=http://192.XXX.XXX.X -Dsonar.projectKey=TEST
 -Dsonar.projectName=TEST-driver -Dsonar.branch=master
 -Dsonar.projectVersion=2.0.0.0 
 -Dsonar.java.libraries=/workspace/build/workspace/jars/*.jar,/workspace/build/workspace/build/gradle/portal/compile/lib/*.jar,/usr/lib64/jvm/java/lib/*.jar'

日志:

INFO: Runner configuration file: NONE
INFO: Project configuration file: /workspace/build/workspace/CH-coprhd-controller-master-sonar/coprhd-controller-sonar-runner.properties
INFO: SonarQube Runner 2.5-RC1
INFO: Java 1.7.0_71 Oracle Corporation (64-bit)
INFO: Linux 3.16.6-2-desktop amd64
INFO: SONAR_RUNNER_OPTS=-Xmx2048m -XX:MaxPermSize=512m
INFO: Error stacktraces are turned on.
INFO: User cache: /workspace/build/workspace/CH-coprhd-controller-master-sonar/.sonar/cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=166ms
INFO: User cache: /workspace/build/workspace/CH-coprhd-controller-master-sonar/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=3ms
INFO: Download sonar-issues-density-plugin-1.0.jar
INFO: Download sonar-javascript-plugin-2.8.jar
INFO: Download sonar-findbugs-plugin-3.3.jar
INFO: Download sonar-groovy-plugin-1.3.jar
INFO: Download sonar-build-stability-plugin-1.3.jar
INFO: Download sonar-xml-plugin-1.3.jar
INFO: Download sonar-web-plugin-2.4.jar
INFO: Download sonar-clover-plugin-3.0.jar
INFO: Download sonar-sonargraph-plugin-3.4.2.jar
INFO: Download sonar-python-plugin-1.5.jar
INFO: Download sonar-scm-git-plugin-1.1.jar
INFO: Download sonar-scm-svn-plugin-1.2.jar
INFO: Download sonar-checkstyle-plugin-2.4.jar
INFO: Download sonar-pmd-plugin-2.5.jar
INFO: Download sonar-java-plugin-3.7.1.jar
INFO: Download sonar-generic-coverage-plugin-1.1.jar
INFO: Download sonar-css-plugin-1.5.jar
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
Exception in thread "main" java.lang.NoClassDefFoundError: org/picocontainer/Startable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
    at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
    at org.sonar.plugins.issuesdensity.IssuesDensityPlugin.getExtensions(IssuesDensityPlugin.java:37)
    at org.sonar.batch.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:51)
    at org.sonar.batch.scan.ProjectScanContainer.addBatchExtensions(ProjectScanContainer.java:234)
    at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:119)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:98)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
    at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
    at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:275)
    at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:166)
    at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:153)
    at org.sonar.runner.cli.Main.runAnalysis(Main.java:118)
    at org.sonar.runner.cli.Main.execute(Main.java:80)
    at org.sonar.runner.cli.Main.main(Main.java:66)
Caused by: java.lang.ClassNotFoundException: org.picocontainer.Startable
    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)
    ... 34 more
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 9,469ms last 8 cycles average is 1,183ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 28,431ms last 8 cycles average is 3,553ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 33,431ms last 8 cycles average is 4,178ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 2,661ms last 8 cycles average is 332ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 10,554ms last 8 cycles average is 1,319ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 9,480ms last 8 cycles average is 1,185ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 8,480ms last 8 cycles average is 1,060ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 11,104ms last 8 cycles average is 1,388ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 39,183ms last 8 cycles average is 4,897ms
INFO: [JOURNAL_FLUSHER] WARNING Journal flush operation took 4,995ms last 8 cycles average is 624ms
Build timed out (after 180 minutes). Marking the build as aborted.

2 个答案:

答案 0 :(得分:0)

此问题密度插件与SQ 5.2不兼容,不再维护。见http://docs.sonarqube.org/display/PLUG/Issues+Density+Plugin。此外,我建议打开页面管理>系统>升级SonarQube之前更新中心。它显示不兼容的插件列表。

答案 1 :(得分:0)

问题是,当SONAR_USER_HOME指向执行sonar_runner的同一文件夹时,SonarQube插件首先被下载到$ SONAR_USER_HOME,然后在分析开始时,该位置被清除以用于每个分析文件模块放在同一个文件夹中。确保SONAR_USER_HOME位于不同的位置解决了该问题。