Not able to start Sonar Server
Asked Answered
S

7

12

I am using Sonar to generate code review reports of my project. But I am not able to start the server. I am getting

HeapDumpOnOutOfMemoryError

while running

StartSonar.bat

file.

Please find the logs generated while sonar start up.

C:\TEMP2\Sonar\sonarqube-4.5\bin\windows-x86-32>StartSonar.bat wrapper | --> Wrapper Started as Console wrapper | Launching a JVM... jvm 1
| Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved. jvm 1 | jvm 1 | 2015.07.28 07:30:51 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Software\jdk1.6.0_18\jre\bin\java -Xmx256m -Xms256m - Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyO nly -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Djava.io.tmpdir=C:\TEMP2\Sonar\sonarqube-4.5\temp -cp ./lib/common/;./lib/search/ org. sonar.search.SearchServer C:\Users\gxs114\AppData\Local\Temp\sq-process8934190933893070058properties jvm 1 | 2015.07.28 07:30:57 INFO app[o.s.p.m.Monitor] Process[search] is up jvm 1 | 2015.07.28 07:30:57 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[web]: C:\Software\jdk1.6.0_18\jre\bin\java -Xmx768m -XX:MaxPermSi ze=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=fals e -Djava.io.tmpdir=C:\TEMP2\Sonar\sonarqube-4.5\temp -cp ./lib/common/;./lib/server/ org.sonar.server.app.WebServer C:\Users\gxs114\AppData\Local\Te mp\sq-process4251708419326591677properties jvm 1 | 2015.07.28 07:30:57 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopping jvm 1 | 2015.07.28 07:30:58 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopped wrapper | <-- Wrapper Stopped

C:\TEMP2\Sonar\sonarqube-4.5\bin\windows-x86-32>

How can I solve this issue ? Any idea/solution appreciated.

Sourdough answered 28/7, 2015 at 11:37 Comment(0)
S
20

I got the solution from sonar log files itself. You can find server start up logs in the sonar.log file under directory "sonarqube-4.5\logs".

I was not able to start the server due to following port binding exception :

2015.07.29 02:46:36 ERROR web[o.a.c.h.Http11Protocol]  Failed to initialize end point associated with ProtocolHandler ["http-bio-0.0.0.0-9000"]
java.net.BindException: Address already in use: JVM_Bind /0.0.0.0:9000
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:411) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:640) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434) ~[tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119) [tomcat-embed-core-7.0.54.jar:7.0.54]

So, I changed the port number to "4950" from "9000" in sonar.properties file under directory "sonarqube-4.5\conf".

# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=4950

# TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
#sonar.web.https.port=-1

The server got successfully started after changing the port number.

Sourdough answered 29/7, 2015 at 6:59 Comment(3)
After changing the port as you suggested: 2016.03.15 16:25:47 ERROR web[o.a.t.u.d.Digester] Parse Fatal Error at line 1 column 1: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [na:1.7.0_40-ea] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) [na:1.7.0_40-ea]Pierre
Sorry, as per your i tried but no change it's throwing same errorColoratura
@Gunjan Shah, I am getting like this type error while trying to start sonar 'java.lang.RuntimeException: Failed to reset file system' . Have you any idea or help ?Coloratura
A
8

If you had already started Sonar and killed the process on command prompt, your JVM would still be running in the background.

Kill the java process and try again, it works. Tried and worked for me.

Aleuromancy answered 6/4, 2016 at 0:37 Comment(0)
M
7

The reason behind this problem is that port number is already in use by SONAR, you didn't properly end the SONAR. There are two ways to get rid of this,

  1. Identify the port number using log file(sonarqube-4.5\logs). Then identify the PID for that process. Then kill the process using PID.

The log will look like

java.net.BindException: Address already in use: **JVM_Bind /0.0.0.0:9000**

To find PID

netstat -a -n -o | find "port_num"

To Kill Process

taskkill /F /PID "pid"
  1. Just log off the system and login again, then start the StartSonar.bat file. It will definitely work.
Merlinmerlina answered 14/7, 2016 at 12:19 Comment(0)
C
2

Task Manager-> Details then Right click-> end task -> for all java.exe if not sure of port number. Then open again cmd prompt ->startsonar.bat

Cleromancy answered 1/9, 2017 at 10:14 Comment(0)
P
1

As per my observation if Eclipse already running then first close the eclipse. check the port 9000 is free.

then after run the sonar from command prompt once the server is up then after run the eclipse.

Photoperiod answered 10/3, 2018 at 11:13 Comment(0)
B
1

You only need to change the port in sonar.properties file

Look sonar.web.port="CHANGE_PORT_NUMBER"

Britzka answered 28/3, 2020 at 20:22 Comment(0)
D
0

I installed sonarqube for swift with Version 0.4.3 is now working ok on SonarQube 7.3 and above : https://github.com/Backelite/sonar-swift/releases/tag/0.4.3.

Devilry answered 19/7, 2022 at 8:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.