[英]SonarQube Eclipse plugin 3.4 Sonar server can not be reached because of connection time out
I've installed SonarQube Eclipse plugin 3.4 on RAD 9 (Eclipse 4.2 ) I have provided the server URL (SonarQube server 4.5.4) and tested the connection... Everything is OK. 我已经在RAD 9(Eclipse 4.2)上安装了SonarQube Eclipse插件3.4。我已经提供了服务器URL(SonarQube服务器4.5.4)并测试了连接...一切正常。
When I've associated my project to SonarQube the project is recognised but when it starts to retrieve remote issue (after click on analyse) I get this exception: 当我将项目关联到SonarQube时,该项目将被识别,但是当它开始检索远程问题时(单击analyse之后),我将收到此异常:
Retrieve remote issues of project myProject...
Start SonarQube analysis on myProject...
ERROR: Sonar server 'https://sonarServer/sonar' can not be reached
Exception in thread "main" org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException: java.net.ConnectException: Connection timed out: connect
at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1392)
at org.sonar.runner.kevinsawicki.HttpRequest.ok(HttpRequest.java:1417)
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:90)
at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:48)
at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:39)
at org.sonar.runner.impl.ServerVersion.is35Compatible(ServerVersion.java:63)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:39)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
at java.security.AccessController.doPrivileged(AccessController.java:274)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: java.net.ConnectException: Connection timed out: connect
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:68)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:529)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1674)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1672)
at java.security.AccessController.doPrivileged(AccessController.java:330)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1670)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1243)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at com.ibm.net.ssl.www2.protocol.https.b.getResponseCode(b.java:27)
at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390)
... 12 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:358)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:219)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:201)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:616)
at com.ibm.jsse2.qc.connect(qc.java:46)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:490)
at com.ibm.net.ssl.www2.protocol.https.c.<init>(c.java:179)
at com.ibm.net.ssl.www2.protocol.https.c.a(c.java:172)
at com.ibm.net.ssl.www2.protocol.https.d.getNewHttpClient(d.java:21)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:62)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2677)
at com.ibm.net.ssl.www2.protocol.https.b.getHeaderField(b.java:35)
at org.sonar.runner.kevinsawicki.HttpRequest.header(HttpRequest.java:1903)
at org.sonar.runner.kevinsawicki.HttpRequest.contentType(HttpRequest.java:2308)
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:86)
... 10 more
edit here is server access.log 在这里编辑是服务器access.log
127.0.0.1 - - [03/01/2016:10:26:58 +0200] "GET /sonar/api/server/index HTTP/1.1" 200 55 "-" "Apache-HttpClient/4.2.2 (java 1.5)"
127.0.0.1 - - [03/01/2016:10:27:05 +0200] "GET /sonar/api/authentication/validate HTTP/1.1" 200 14 "-" "Apache-HttpClient/4.2.2 (java 1.5)"
127.0.0.1 - - [03/01/2016:10:27:16 +0200] "GET /sonar/api/server/index HTTP/1.1" 200 55 "-" "Apache-HttpClient/4.2.2 (java 1.5)"
127.0.0.1 - - [03/01/2016:10:27:55 +0200] "GET /sonar/api/resources?resource=com.myproject%3Amymodule%3ASNAPSHOT&verbose=false& HTTP/1.1" 200 306 "-" "Apache-HttpClient/4.2.2 (java 1.5)"
127.0.0.1 - - [03/01/2016:10:28:04 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=1 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:09 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=2 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:13 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=3 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:17 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=4 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:21 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=5 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:24 +0200] "GET /sonar/api/issues/search?resolved=false&pageSize=-1&componentRoots=com.myproject:mymodule:SNAPSHOT&pageIndex=6 HTTP/1.1" 200 - "-" "Java/1.7.0"
127.0.0.1 - - [03/01/2016:10:28:36 +0200] "GET /sonar/api/resources?resource=com.myproject%3Amymodule%3ASNAPSHOT&metrics=&verbose=false& HTTP/1.1" 200 306 "-" "Apache-HttpClient/4.2.2 (java 1.5)"
Nothing is displayed on the sonar.log file sonar.log文件上没有任何显示
end of edit 编辑结束
Sometimes it retrieve a part of the issue sometimes no one of them 有时它检索到问题的一部分,有时没有一个
Thanks 谢谢
I have found that the following command is executed when launching analyse using eclipse: 我发现使用eclipse启动分析时执行了以下命令:
java.exe -cp C:\Users\xxxx\AppData\Local\Temp\sonar-runner-impl6867841822221012221.jar
org.sonar.runner.impl.BatchLauncherMain
C:\Users\xxxx\AppData\Local\Temp\sonar-project3666940761827968492.properties
Because I'am working behind a proxy which is configurated in eclipse network preferences section, it will not reach the server unless the proxy configuration is added. 因为我在eclipse网络首选项部分中配置的代理后面工作,所以除非添加了代理配置,否则它将不会到达服务器。 So to test I have executed the command line with the proxy configuration options for https (-Dhttps.proxyHost -Dhttps.proxyPort -Dhttps.proxyUser -Dhttps.proxyPassword) and the command have succeeded.
因此,要进行测试,我已经使用https的代理配置选项执行了命令行(-Dhttps.proxyHost -Dhttps.proxyPort -Dhttps.proxyUser -Dhttps.proxyPassword),并且命令已成功执行。
I think it's a bug. 我认为这是一个错误。 The plugin must check either a proxy configuration exists or not before creating and launching the command
在创建和启动命令之前,插件必须检查代理配置是否存在
Edit 编辑
To resolve the problem go to preferences>>SonarQube>>JVM arguments for preview analysis: put the proxy params in that field and it should works 要解决该问题,请转至首选项>> SonarQube >> JVM参数进行预览分析:将代理参数放在该字段中,它应该可以工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.