引导异常:服务器返回 HTTP 响应代码:声纳 URL 的 400



我正在使用jdk-1.7.0_51,Sonarqube-4.5.1和Ant-1.9.1。当目标:声纳通过詹金斯中的蚂蚁步骤调用时,我收到以下错误。Ant-1.8.4 也是如此。

Buildfile: /cip/jenkins/workspace/test/build.xml
 [echo] the current time is 18/01/2016_14:06:37:037
sonar:
[sonar:sonar] Apache Ant(TM) version 1.8.4 compiled on May 22 2012
[sonar:sonar] Sonar Ant Task version: 1.0
[sonar:sonar] Loaded from: file:/cip/opt/apache-ant-1.8.4/lib/sonar-ant-task-1.0.jar
[sonar:sonar] Sonar work directory: /cip/jenkins/workspace/test/.sonar
[sonar:sonar] Sonar server: http://localhost:9000/sonar
[sonar:sonar] Sonar version: 4.5.1
BUILD FAILED
/cip/jenkins/workspace/test/build.xml:1007: org.sonar.batch.bootstrapper.BootstrapException: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:9000/sonar/batch/
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:164)
at org.sonar.batch.bootstrapper.Bootstrapper.createClassLoader(Bootstrapper.java:87)
at org.sonar.ant.SonarTask.createClassLoader(SonarTask.java:180)
at org.sonar.ant.SonarTask.execute(SonarTask.java:151)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:9000/sonar/batch/
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at java.net.URLConnection.getContent(URLConnection.java:748)
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContent(Bootstrapper.java:123)
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:156)
... 19 more
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

访问 http://localhost:9000/sonar/batch/时,我得到 {"错误":[{"msg":"错误的文件名:"}]}

我的构建.xml有

    <property environment="env"/>
<property name="sonar.host.url" value="${env.SONAR_HOST}"/>
<property name="sonar.jdbc.url" value="${env.SONAR_JDBC}"/>
<property name="sonar.jdbc.driverClassName" value="${env.JDBC_DRIVER}"/>
<property name="sonar.jdbc.username" value="${env.SONAR_USR}"/>
<property name="sonar.jdbc.password" value="${env.SONAR_PWD}"/>
<property name="sonar.login" value="${env.UI_USR}"/>
<property name="sonar.password" value="${env.UI_PWD}"/>
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="/cip/opt/apache-ant-1.8.4/lib"/>
</taskdef>
<target name="sonar">
<property name="sonar.sources" value="src"/>
<property name="sonar.projectName" value="test"/>
<sonar:sonar workDir="src/temp" key="test:test" version="Trunk"/>
</target>

我的问题类似于声纳蚂蚁任务执行错误,但这没有得到回答。

早些时候它在声纳 4.0 上工作正常,但现在我面临此错误。

这是因为声纳-蚂蚁任务-1.0.jar吗? 这与声纳

Qube 4.5.1不兼容吗? 我使用了声纳-蚂蚁任务-2.0.jar但我得到不同的错误。

sonar:
BUILD FAILED
/cip/jenkins/workspace/test/build.xml:99: sonar:sonar doesn't support the "workDir" attribute
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

因此,我删除了build中的工作目录路径.xml然后我收到此错误

sonar:
[sonar:sonar] Apache Ant(TM) version 1.9.1 compiled on May 15 2013
[sonar:sonar] Sonar Ant Task version: 2.0
[sonar:sonar] Loaded from: file:/cip/opt/apache-ant-1.9.1/lib/sonar-ant-task-2.0.jar
[sonar:sonar] Sonar work directory: /cip/jenkins/workspace/test/.sonar
[sonar:sonar] Sonar server: http://localhost:9000/sonar
[sonar:sonar] *****************************************************************************************************************************************
[sonar:sonar] /! Sonar Ant Task running in compatibility mode: please refer to the documentation to udpate your scripts to comply with the standards.
[sonar:sonar] *****************************************************************************************************************************************
[sonar:sonar] Sonar version: 4.5.1
BUILD FAILED
/cip/jenkins/workspace/test/build.xml:99: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonar.runner.Bootstrapper.downloadBatchFiles(Bootstrapper.java:166)
at org.sonar.runner.Bootstrapper.createClassLoader(Bootstrapper.java:89)
at org.sonar.runner.DeprecatedAntTaskExecutor.createClassLoader(DeprecatedAntTaskExecutor.java:123)
at org.sonar.runner.DeprecatedAntTaskExecutor.execute(DeprecatedAntTaskExecutor.java:65)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:86)
at org.sonar.ant.SonarTask.execute(SonarTask.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
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.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:9000/sonar/batch/
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at java.net.URLConnection.getContent(URLConnection.java:748)
at org.sonar.runner.Bootstrapper.remoteContent(Bootstrapper.java:125)
at org.sonar.runner.Bootstrapper.downloadBatchFiles(Bootstrapper.java:158)
... 22 more
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

这种错误的可能原因是什么?
谢谢你的回答。

是的,确实是一个声纳-蚂蚁任务版本不兼容
sonarqube1.0版本与Sonarqube 4.5.1不兼容。
在快速蚂蚁-1.8.4/lib 中复制 Sonarqube-ant-task-2.4 后作业已执行

相关内容

  • 没有找到相关文章

最新更新