自升级到Sonarqube 6.0以来,我无法对其中一个项目进行分析。
此项目通过maven插件执行声纳分析,但失败并显示以下错误:
Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project rating-parent: Error 500 on http://sonar.example.com/api/ce/submit?projectKey=com.example.rating-parent&projectName=Rating%20System&projectBranch=develop
检查服务器上的sonar.log(通过AJP位于Apache 2.4服务器后面)显示了这个堆栈跟踪:
2016.08.12 10:50:14 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://sonar.example.com/api/ce/submit?projectKey=com.example.rating:rating-parent&projectName=Rating%20System&projectBranch=develop
java.lang.IllegalStateException: Can't read file part
at org.sonar.server.ws.ServletRequest.readPart(ServletRequest.java:93) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.ServletRequest.readInputStreamParam(ServletRequest.java:76) ~[sonar-server-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.paramAsInputStream(ValidatingRequest.java:74) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:84) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:109) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:74) [sonar-server-6.0.jar:na]
at org.sonar.server.platform.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:125) [sonar-server-6.0.jar:na]
at org.sonar.server.platform.MasterServletFilter.doFilter(MasterServletFilter.java:94) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:56) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.platform.RoutesFilter.doFilter(RoutesFilter.java:55) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.platform.ProfilingFilter.doFilter(ProfilingFilter.java:84) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.32.jar:8.0.32]
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:191) [logback-access-1.1.3.jar:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3736099) exceeds the configured maximum (2097152)
at org.apache.catalina.connector.Request.parseParts(Request.java:2846) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.parseParameters(Request.java:3151) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.getParameter(Request.java:1108) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.ws.ServletRequest.readParam(ServletRequest.java:71) ~[sonar-server-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.readParamOrDefaultValue(ValidatingRequest.java:134) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:86) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:68) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.Request.mandatoryParam(Request.java:63) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:81) ~[sonar-server-6.0.jar:na]
... 30 common frames omitted
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3736099) exceeds the configured maximum (2097152)
at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:811) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:256) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:280) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.parseParts(Request.java:2776) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
... 39 common frames omitted
我从中收集到的是,错误是由于提交给Sonarqube服务器的分析报告的大小(大约3,7 MB)大于嵌入式Tomcat服务器的上传限制大约2 MB。
目标/声纳/批处理报告中文件的累积大小确实大约为3,7 MB,所以我猜堆栈跟踪是正确的。
我还尝试了一个较小的项目(总计大约1,3M的报告),它没有问题。
我是从Jenkins服务器运行它还是从命令行本地调用Maven(3.3.9)并不重要。
假设没有办法减少报告大小(3,7 MB异常?),我可以通过增加Tomcat的最大上传大小来解决这个问题。我知道如何在常规Tomcat安装中执行此操作,但我不知道如何为Sonarqube的嵌入式Tomcat服务器执行此操作。