7
votes

I am facing the issue after successful installing sonarqube and sonar runner. When I run in project /sonar-runner it is showing error. Anyone can help ?

ERROR: Sonar server 'http://localhost:9000' can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.109s
Final Memory: 0M/87M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException: java.net.ConnectException: Connection refused 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:93) at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:47)
at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:38)
at org.sonar.runner.impl.ServerVersion.is37Compatible(ServerVersion.java:58)
at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:36) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71) at java.security.AccessController.doPrivileged(Native Method) 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.net.ConnectException: Connection refused
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:534) at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1548) at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1544) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1542) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1193) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:397) at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390) ... 15 more

Below mention sonar log is:

    --> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

WrapperSimpleApp: Unable to locate the class org.sonar.application.App: java.lang.UnsupportedClassVersionError: org/sonar/application/App : Unsupported major.minor version 51.0

WrapperSimpleApp Usage:
  java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]

Where:
  app_class:      The fully qualified class name of the application to run.
  app_arguments:  The arguments that would normally be passed to the
                  application.
2
It seems that this is a jenkins error/console log. If so check if you have configured sonar-runner plugin correctly, check if you have uncommented conf file from sonar-runner also.hrskrs
I have enabled conf/sonar.properties and /sonar-runner/conf/sonar-runner.properties.user5340537
Can you check if sonar is working locally(localhost:8080)? Also giving more details about what sonar version and os are you using, how you configured(you included a sonar-project.properties file or configured on jenkins), etc maybe can help us figure out.hrskrs
No sonar-runner is not working locally and sonar version is 5.1.2.user5340537
can you post the conf/sonar.log stacktrace?hrskrs

2 Answers

0
votes

In my case, i have replaced the sonar.host.url=http://10.xxx.XX.30:9000

0
votes

The java.lang.UnsupportedClassVersionError issue happens when you try to run program class files created using higher Java version into lower Java version. To resolve this issue follow these steps:

  1. Go to /opt/sonar/sonarqube-6.7.3/conf
  2. Edit below line in wrapper.conf file and restart sonar. wrapper.java.command=/My/jdk_home/bin/java