为什么jenkins的sonarqube调用失败了HTTP 500?

时间:2016-02-09 13:09:24

标签: jenkins sonarqube

我在jenkins中运行构建作业,分析java代码Web项目。编译和构建部分工作正常。调用sonarqube时,作业失败。 我在jenkins中收到以下错误消息:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project PROJECT: Unable to load component class org.sonar.api.config.Settings: Unable to load component class org.sonar.batch.repository.ProjectRepositories: Error 500 on http://example.com/sonar/batch/project.protobuf?key=PROJECT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project PROJECT: Unable to load component class org.sonar.api.config.Settings
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to load component class org.sonar.api.config.Settings
at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:81)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.api.config.Settings
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:62)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:262)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:111)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:130)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:67)
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:497)
at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy16.execute(Unknown Source)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:274)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:78)
... 22 more
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.batch.repository.ProjectRepositories
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:62)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
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.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:60)
... 44 more
Caused by: org.sonarqube.ws.client.HttpException: Error 500 on http://example.com/sonar/batch/project.protobuf?key=PROJECT
at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:32)
at org.sonar.batch.bootstrap.BatchWsClient.failIfUnauthorized(BatchWsClient.java:96)
at org.sonar.batch.bootstrap.BatchWsClient.call(BatchWsClient.java:67)
at org.sonar.batch.cache.WSLoader$3.load(WSLoader.java:85)
at org.sonar.batch.cache.WSLoader$3.load(WSLoader.java:81)
at org.sonar.batch.cache.WSLoader.loadFromServer(WSLoader.java:225)
at org.sonar.batch.cache.WSLoader.loadFromServerFirst(WSLoader.java:188)
at org.sonar.batch.cache.WSLoader.load(WSLoader.java:148)
at org.sonar.batch.cache.WSLoader.loadStream(WSLoader.java:124)
at org.sonar.batch.repository.DefaultProjectRepositoriesLoader.load(DefaultProjectRepositoriesLoader.java:60)
at org.sonar.batch.repository.ProjectRepositoriesProvider.provide(ProjectRepositoriesProvider.java:45)
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:497)
at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
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.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:60)
... 58 more

sonarQube登录级别TRACE|DEBUG|INFO中的错误消息如下:

2016.02.09 10:59:04 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://example.com/sonar/batch/project.protobuf?key=PROJECT
java.lang.NullPointerException: null

我在jenkins 1.646上使用oracle java 1.8.0_72-b15 debian 7.9 (wheezy)。 SonarQube是版本5.3PostgreSQL 9.1.18。它使用与在同一台机器上运行相同的java vm。

这个jenkins实例中的工作没有失败,并且能够将数据提交给sonarqube,因此工作流程没问题。

我找不到任何有用的东西通过谷歌解决这个问题,因此需要你的帮助。

您还需要其他信息吗?

更新

#1 23.02.2016 - 10:16 CET

插件列表:

$ ls -1 /opt/sonar/extensions/plugins/
README.txt
sonar-checkstyle-plugin-2.4.jar
sonar-cobertura-plugin-1.6.3.jar
sonar-findbugs-plugin-3.3.jar
sonar-java-plugin-3.9.jar
sonar-l10n-de-plugin-1.2.jar
sonar-php-plugin-2.7.jar
sonar-pmd-plugin-2.5.jar
sonar-scm-git-plugin-1.1.jar
sonar-scm-svn-plugin-1.2.jar

#2 02.03.2016 - 11:49 CET

今天,SonarQube记录了一个例外:

2016.03.02 10:45:40 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://example.com/sonar/batch/project.protobuf?key=PROJECT
java.lang.NullPointerException: null
    at com.google.protobuf.Utf8.encodedLength(Utf8.java:378) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.CodedOutputStream.computeStringSizeNoTag(CodedOutputStream.java:911) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.FieldSet.computeElementSizeNoTag(FieldSet.java:834) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.MapEntryLite.getFieldSize(MapEntryLite.java:143) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.MapEntryLite.getSerializedSize(MapEntryLite.java:135) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.MapEntry.getSerializedSize(MapEntry.java:120) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag(CodedOutputStream.java:947) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at com.google.protobuf.CodedOutputStream.computeMessageSize(CodedOutputStream.java:707) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at org.sonarqube.ws.WsBatch$WsProjectResponse.getSerializedSize(WsBatch.java:1878) ~[sonar-ws-5.3.jar:na]
    at com.google.protobuf.AbstractMessageLite.writeTo(AbstractMessageLite.java:77) ~[protobuf-java-3.0.0-beta-1.jar:na]
    at org.sonar.server.ws.WsUtils.writeProtobuf(WsUtils.java:49) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.batch.ProjectAction.handle(ProjectAction.java:83) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:85) ~[sonar-server-5.3.jar:na]
    at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_74]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_74]
    at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:425) [jruby-complete-1.7.9.jar:na]
    at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:292) [jruby-complete-1.7.9.jar:na]
    at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:44) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70) [jruby-complete-1.7.9.jar:na]
    at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59) [jruby-complete-1.7.9.jar:na]
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) [jruby-complete-1.7.9.jar:na]
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) [jruby-complete-1.7.9.jar:na]
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:161) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:190) [jruby-complete-1.7.9.jar:na]
    at org.jruby.RubyClass.finvoke(RubyClass.java:527) [jruby-complete-1.7.9.jar:na]
    at org.jruby.RubyBasicObject.send(RubyBasicObject.java:2590) [jruby-complete-1.7.9.jar:na]
    at org.jruby.RubyKernel.send(RubyKernel.java:2223) [jruby-complete-1.7.9.jar:na]
    at org.jruby.RubyKernel$INVOKER$s$send.call(RubyKernel$INVOKER$s$send.gen) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:350) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Base$$perform_action_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B2117389415.__file__(/opt/sonar/web/WEB-INF/
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1333) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Base$$perform_action_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B2117389415.__file__(/opt/sonar/web/WEB-INF/
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:141) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:185) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:56) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Filters::InstanceMethods$$call_filters_A7E1D3FFBF56E3CB7C0EBA850688505249A05AE92117389415.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:617) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Filters::InstanceMethods$$call_filters_A7E1D3FFBF56E3CB7C0EBA850688505249A05AE92117389415.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:261) [jruby-complete-1.7.9.jar:na]
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Filters::InstanceMethods$$perform_action_with_filters_4C7C67B4A5564FF5DC76344AF2372660F608839C2117389415.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:610) [jruby-complete-1.7.9.jar:na]
    at rubyjit.ActionController::Filters::InstanceMethods$$perform_action_with_filters_4C7C67B4A5564FF5DC76344AF2372660F608839C2117389415.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb) [jruby-complete-1.7.9.jar:na]
    at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:141) [jruby-complete-1.7.9.jar:na]
[...]

这里我切断了堆栈跟踪。如果您需要更多详细信息,请询问。

1 个答案:

答案 0 :(得分:0)

你面对https://jira.sonarsource.com/browse/SONAR-7084。如果先前的分析是使用小于4.2的SonarQube版本完成分析,则分析失败。显然,根据JIRA门票的最新评论,这个问题没有完全解决。