SonarQube server [http://localhost:9001] can not be reached (Already check all the previous Q. on stackoverflow) - sonarqube

I am getting below error after running command sonar-scanner. My scanner version is sonar-scanner-2.6.1, sonarqube version is sonarqube5.4, java version "1.8.0_161",Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
,Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
I have also try with other ports like 9001, 9002 but it is still not workig.
INFO: Scanner configuration file: /opt/sonar-scanner-2.6.1/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/parth-favcy/favcy/favcy/value-x/sonar-project.properties
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_161 Oracle Corporation (64-bit)
INFO: Linux 4.13.0-36-generic amd64
INFO: User cache: /home/parth-favcy/.sonar/cache
ERROR: SonarQube server [http://localhost:9001] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.373s
INFO: Final Memory: 3M/119M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to download libraries from server
ERROR: Caused by: Connection refused (Connection refused)
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Scanner with the -e switch.
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
parth-favcy#parthfavcy-HP-Notebook:~/favcy/favcy/value-x$ /opt/sonar-scanner-2.6.1/bin/sonar-scanner -X
INFO: Scanner configuration file: /opt/sonar-scanner-2.6.1/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/parth-favcy/favcy/favcy/value-x/sonar-project.properties
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_161 Oracle Corporation (64-bit)
INFO: Linux 4.13.0-36-generic amd64
INFO: User cache: /home/parth-favcy/.sonar/cache
DEBUG: Extract sonar-scanner-api-batch in temp...
DEBUG: Get bootstrap index...
DEBUG: Download: http://localhost:9001/batch_bootstrap/index
ERROR: SonarQube server [http://localhost:9001] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.341s
INFO: Final Memory: 3M/119M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:70)
at org.sonarsource.scanner.cli.Main.main(Main.java:60)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
... 8 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.Platform.connectSocket(Platform.java:101)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connectSocket(Connection.java:198)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connect(Connection.java:172)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Connection.connectAndSetOwner(Connection.java:358)
at org.sonarsource.scanner.api.internal.shaded.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:117)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:329)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.getResponse(Call.java:276)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.getResponseWithInterceptorChain(Call.java:196)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Call.execute(Call.java:79)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:114)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:78)
... 11 more
----------------------------------------------------------------------
My iptable rule :
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (0 references)
target prot opt source destination
Chain DOCKER-ISOLATION (0 references)
target prot opt source destination
Chain DOCKER-USER (0 references)
target prot opt source destination
---------------------------------------------------------
Sonar Properties file :
#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://localhost:9001
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
#----- Global database settings (not used for SonarQube 5.2+)
#sonar.jdbc.username=sonar
#sonar.jdbc.password=sonar
#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:#localhost/XE
#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
sonar.properties file : https://drive.google.com/open?id=1Dc1sj0_lcGpQ41NoFmRZH593ww-4Bf_F

Related

Jenkins: org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube

Using sonar-scanner failed with an ERROR, although the Get bootstrap completed step ran successfully before. Seeing
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
More details:
/opt/sonar-scanner/bin/sonar-scanner -X -Djavax.net.debug="ssl,handshake" -Dsonar.projectKey=project-header-forwarding -Dsonar.projectName=project-header-forwarding -Dsonar.projectVersion=0.0.80 -Dsonar.sourceEncoding=UTF-8 -Dsonar.host.url=http://my-sonarsystem:9000 -Dsonar.projectBaseDir=/home/jenkins-master/workspace/project-header-forwarding_master
11:55:59.205 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
11:55:59.221 INFO: Project root configuration file: NONE
11:55:59.270 INFO: SonarQube Scanner 2.8
11:55:59.270 INFO: Java 1.8.0_212 Oracle Corporation (64-bit)
11:55:59.270 INFO: Linux 3.10.0-957.12.2.el7.x86_64 amd64
11:55:59.560 DEBUG: keyStore is :
11:55:59.561 DEBUG: keyStore type is : jks
11:55:59.561 DEBUG: keyStore provider is :
11:55:59.561 DEBUG: init keystore
11:55:59.562 DEBUG: init keymanager of type SunX509
11:55:59.665 INFO: User cache: /home/wpci/.sonar/cache
11:55:59.665 DEBUG: Extract sonar-scanner-api-batch in temp...
11:55:59.680 DEBUG: Get bootstrap index...
11:55:59.680 DEBUG: Download: http://my-sonarsystem:9000/batch_bootstrap/index
11:55:59.962 DEBUG: Get bootstrap completed
11:55:59.969 INFO: ------------------------------------------------------------------------
11:55:59.970 INFO: EXECUTION FAILURE
11:55:59.970 INFO: ------------------------------------------------------------------------
11:55:59.971 INFO: Total time: 0.832s
11:56:00.014 INFO: Final Memory: 4M/178M
11:56:00.014 INFO: ------------------------------------------------------------------------
11:56:00.014 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
... 8 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:87)
... 11 more
You're running a version of Sonar Scanner that isn't compatible with your version of SonarQube.
More specifically, the version of Sonar Scanner you're using attempts to download the relevant scanner Jars by getting a list from the batch_bootstrap/index endpoint of your SonarQube server, but this was deprecated then removed in more recent SonarQube versions, in favour of bootstrap/index so the scanner is attempting to parse an empty list of Jars.
Depending on which version of SonarQube you're running, updating to Sonar Scanner 4 should overcome this.

SonarQube scanner can't connect to server

I faced the issue with the sonar-scanner-cli which can't connect to the SonarQube server. Scan is run from within the docker container. Docker connects to SonarQube server through proxy so I thought that it was the issue but I tried to set proxy environment variables and also pass proxy parameters to the scanner. That didn't help. Also other binaries like yum or gradle can connect to external repos without problem from the same container.
SonarQube server version: 6.7.0.33306.
13:12:28.858 INFO: Scanner configuration file: /home/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_2.8/sonar-scanner-2.8/conf/sonar-scanner.properties
13:12:28.869 INFO: Project root configuration file: NONE
13:12:28.937 INFO: SonarQube Scanner 2.8
13:12:28.937 INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
13:12:28.937 INFO: Linux
3.10.0-693.2.2.el7.x86_64 amd64
13:12:29.854 DEBUG: keyStore is :
13:12:29.854 DEBUG: keyStore type is : jks
13:12:29.854 DEBUG: keyStore provider is :
13:12:29.854 DEBUG: init keystore
13:12:29.854 DEBUG: init keymanager of type SunX509
13:12:30.067 DEBUG: Create : /home/jenkins/.sonar/cache
13:12:30.074 INFO: User cache: /home/jenkins/.sonar/cache
13:12:30.074 DEBUG: Create : /home/jenkins/.sonar/cache/_tmp
13:12:30.075 DEBUG: Extract sonar-scanner-api-batch in temp...
13:12:30.088 DEBUG: Get bootstrap index...
13:12:30.089 DEBUG: Download: https://hostname/batch_bootstrap/index
13:12:30.133 ERROR: SonarQube server [https://hostname] can not be reached
13:12:30.133 INFO:
------------------------------------------------------------------------
13:12:30.133 INFO: EXECUTION FAILURE
13:12:30.134 INFO:
------------------------------------------------------------------------
13:12:30.134 INFO: Total time: 1.342s
13:12:30.153 INFO: Final Memory: 4M/148M
13:12:30.154 INFO:
------------------------------------------------------------------------
13:12:30.154 ERROR: Error during SonarQube Scanner execution org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75) ... 8 more Caused by: java.net.ConnectException: Failed to connect to hostname/IP:443
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:187)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.buildConnection(RealConnection.java:170)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.io.RealConnection.connect(RealConnection.java:111)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:187)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:123)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:296)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponse(RealCall.java:243)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:57)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:113)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:78)
... 11 more
I think you should verify your firewall. In most systems, port 9000 is not open and it is a common source of failure.

Status returned by url [http://localhost:9000/batch_bootstrap/index] is not valid

When I am trying to run sonar-scanner, I was not able to start sonarqube and this error is being displayed.
INFO: Scanner configuration file: /sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_91 Oracle Corporation (64-bit)
INFO: Mac OS X 10.12.1 x86_64
INFO: User cache: /.sonar/cache
ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.417s
INFO: Final Memory: 3M/123M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
... 8 more
Caused by: java.lang.IllegalStateException: Status returned by url [http://localhost:9000/batch_bootstrap/index] is not valid: [404]
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:78)
... 11 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Actually, you should first start SonarQube. When it runs, then you can start your scanner.
I get the case where my port 9001 was already in used and SonarQube server did't start. To resolve it, I changed the port to 19001 (free on my computer) in SonarQube_Dir/conf/sonar.properties
sonar.search.port=19001
After this change, I was able to start the sonarQube server, and run the scanner.

sonar-runner.bat Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher .java:91)

I got the latest sonar-runner-dist-2.4 and sonarqube-4.3. Server starts fine, i can see the localhost But when i try to run the sonar-runner.bat -X, i see the below error. I looked at versions, logs but couldn't find the root-cause. Any help will be appreciated.
enter code here
MyProject>sonar-runner.bat -X
C:\sonar\sonar-runner-dist-2.4
SonarQube Runner 2.4
Java 1.6.0 IBM Corporation (32-bit)
Windows Vista 6.1 build 7601 Service Pack 1 x86
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar\sonar-runner-dist-2.4\conf\sonar-runne
r.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is
platform dependent)
INFO: Work directory: C:\cww\application\CWW_FSET_R0\online\aeEJB\.\.sonar
INFO: SonarQube Server 4.3
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1.191s
Final Memory: 2M/5M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(AccessController.java:202
)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102
)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.TypeNotPresentException: Type javax.annotation.CheckForNull
not present
at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.j
ava:38)
at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(Annotatio
nHelper.java:50)
at com.ibm.oti.reflect.Method.getDeclaredAnnotations(Method.java:31)
at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:687)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.ja
va:186)
at com.ibm.oti.reflect.Method.getAnnotation(Method.java:20)
at java.lang.reflect.Method.getAnnotation(Method.java:677)
at org.picocontainer.injectors.AdaptingInjection.injectionAnnotated(Adap
tingInjection.java:230)
at org.picocontainer.injectors.AdaptingInjection.access$000(AdaptingInje
ction.java:46)
at org.picocontainer.injectors.AdaptingInjection$1.run(AdaptingInjection
.java:203)
at java.security.AccessController.doPrivileged(AccessController.java:202
)
at org.picocontainer.injectors.AdaptingInjection.injectionMethodAnnotate
d(AdaptingInjection.java:200)
at org.picocontainer.injectors.AdaptingInjection.methodAnnotatedInjectio
nAdapter(AdaptingInjection.java:171)
at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(
AdaptingInjection.java:70)
at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAd
apter(AbstractBehaviorFactory.java:44)
at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptIn
Caching.java:45)
at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContai
ner.java:535)
at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContaine
r.java:83)
at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addC
omponent(DefaultPicoContainer.java:1148)
at org.sonar.api.platform.ComponentContainer.addComponent(ComponentConta
iner.java:175)
at org.sonar.api.platform.ComponentContainer.addSingleton(ComponentConta
iner.java:163)
at org.sonar.api.platform.ComponentContainer.add(ComponentContainer.java
:149)
at org.sonar.batch.bootstrap.BootstrapContainer.addBootstrapComponents(B
ootstrapContainer.java:83)
at org.sonar.batch.bootstrap.BootstrapContainer.doBeforeStart(BootstrapC
ontainer.java:77)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java
:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:87)
... 9 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.CheckForNull
at java.lang.Class.forName(Class.java:169)
at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.j
ava:33)
... 42 more
Here is my property file :
# required metadata
sonar.projectKey=my:MyProject
sonar.projectName=MyProject
sonar.projectVersion=1.0
# optional description
sonar.projectDescription=Any description
# path to source directories (required)
sonar.sources=src
# path to test source directories (optional)
#sonar.tests=testDir1,testDir2
# path to project binaries (optional), for example directory of Java bytecode
sonar.binaries=bin
# The value of the property must be the key of the language.
sonar.language=java
# Additional parameters
sonar.my.property=value
This issue seems to relate to the use of the IBM Java Virtual Machine : http://www-01.ibm.com/support/docview.wss?uid=swg1IZ76354. By using the Oracle one this should fix your issue.

Sonar-runner on remote machine not picking up correct jbdc connection?

I have sonarqube 3.5.1, and sonar-runner 2.2.1 on a RHEL6.2 server, sonar-runner works fine against the sample data I've downloaded.
However, I've deployed sonar-runner to a windows client, and its failing to connect to the H2 database.
INFO: Sonar Server 3.5.1
11:58:19.960 INFO - Load batch settings
11:58:20.116 INFO - User cache: C:\Users\e01942082\.sonar\cache
11:58:20.132 INFO - Install plugins
11:58:21.739 INFO - ------------- Executing Project Scan
11:58:22.113 INFO - Install JDBC driver
11:58:22.129 INFO - Apply project exclusions
11:58:22.129 WARN - H2 database should be used for evaluation purpose only
11:58:22.129 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 8.393s
Final Memory: 2M/15M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to connect to database
ERROR: Caused by: Cannot create PoolableConnectionFactory (Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-167])
ERROR: Caused by: Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-167]
ERROR: Caused by: Connection refused: connect
So, I've updated the sonar-properties in sonarqube
# Comment the following line to deactivate the default embedded database.
sonar.jdbc.url: jdbc:h2:tcp://gbrpsr000000711.xxxxxxxxx.xxxxxxxxxxx.com:9092/sonar
sonar.jdbc.driverClassName: org.h2.Driver
and sonar-runner conencts to the server with the
sonar.host.url=http://gbrpsr000000711.xxxxxxx.xxxxxxxx.com:9000/sonar
its not clear why its picking up the localhost rather than the full url of the server. Am I missing somehting/ or has this been embedded when I started the service prior to making the config changes????
thanks for you assistance
dD

Resources