1

我们已经在一个非常大的多项目存储库(主要是 Java 7、JSP、JS、XML 和 CSS 文件)上在 Unix 系统上使用Java 1.7.0_76下的Sonar 5.1大约一个月了。我们最近注意到 Sonar Runner 在某些情况下执行失败。请参阅下面的 SonarQube 日志中的错误。一些信息:

  • 不同项目中的不同文件会发生这种情况 - 有时是 .java 文件,有时是 .js 文件 - 但每次运行时似乎都以相同的文件一致地发生。
  • 它似乎要求的文件实际上存在于我们的存储库中。
  • 所有项目都由同一用户分析,该用户具有“查看源代码”权限(实际上,任何人都有此权限)。

您能否告诉我们可能导致这些故障的原因,以及我们如何防止它们?谢谢!


在服务器端(在 sonar.log 中)

2015.05.26 02:58:56 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://sonar.era.nih.gov/api/sources/hash?key=PRACS%3Asrc%2Fjava%2Fgov%2Fnih%2Fera%2Fpracs%2Fbeans%2FUploadedDocument.java
java.lang.NullPointerException: null
                at com.google.common.io.CharStreams.copy(CharStreams.java:202) ~[guava-10.0.1.jar:na]
                at org.sonar.server.source.ws.HashAction$HashFunction.apply(HashAction.java:99) ~[sonar-server-5.1.jar:na]
                at org.sonar.server.source.ws.HashAction$HashFunction.apply(HashAction.java:84) ~[sonar-server-5.1.jar:na]
                at org.sonar.core.source.db.FileSourceDao.readLineHashesStream(FileSourceDao.java:94) ~[sonar-core-5.1.jar:na]
                at org.sonar.server.source.ws.HashAction.handle(HashAction.java:74) ~[sonar-server-5.1.jar:na]
                at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:84) ~[sonar-server-5.1.jar:na]
                at sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source) ~[na:na]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_76]
                at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_76]
                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 rubyjit.Api::JavaWsController$$index_18AF0797CD66B4E310384A14E2B9EE369902E67F103261525.__file__(/home/sonarqube/apps/sonarqube/sonarqube-5.1/web/WEB-INF/app/controllers/api/java_ws_controller.rb:30) [jruby-complete-1.7.9.jar:na]
                at rubyjit.Api::JavaWsController$$index_18AF0797CD66B4E310384A14E2B9EE369902E67F103261525.__file__(/home/sonarqube/apps/sonarqube/sonarqube-5.1/web/WEB-INF/app/controllers/api/java_ws_controller.rb) [jruby-complete-1.7.9.jar:na]
                at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:161) [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_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B103261525.__file__(/home/sonarqube/apps/sonarqube/sonarqube-5.1/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_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B103261525.__file__(/home/sonarqube/apps/sonarqube/sonarqube-5.1/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 …

在客户端(声纳运行器)

产生的错误有以下来自 sonar-runner 的输出(如果你需要,我会发送完整的东西,但似乎真正的问题是 NPE):

[sonar-runner] INFO: EXECUTION FAILURE
[sonar-runner] INFO: ------------------------------------------------------------------------
[sonar-runner] Total time: 2:50.798s
[sonar-runner] ERROR: Error during Sonar runner execution [sonar-runner] org.sonar.runner.impl.RunnerException: Unable to execute Sonar [sonar-runner]     at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
…
[sonar-runner] Caused by: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.File@1a89552[key=src/java/gov/nih/era/pracs/beans/UploadedDocument.java,path=src/java/gov/nih/era/pracs/beans/UploadedDocument.java,filename=UploadedDocument.java,language=Java]'
[sonar-runner]     at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:104)
…
[sonar-runner] Caused by: java.lang.IllegalStateException: Fail to execute request [code=500, url=http://sonar.era.nih.gov/api/sources/hash?key=PRACS%3Asrc%2Fjava%2Fgov%2Fnih%2Fera%2Fpracs%2Fbeans%2FUploadedDocument.java]
[sonar-runner]     at org.sonar.batch.bootstrap.ServerClient.handleHttpException(ServerClient.java:139)
…
[sonar-runner] Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://sonar.era.nih.gov/api/sources/hash?key=PRACS%3Asrc%2Fjava%2Fgov%2Fnih%2Fera%2Fpracs%2Fbeans%2FUploadedDocument.java]. Response code: 500 [sonar-runner]     at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:305)
4

0 回答 0