Struggling to get SonarQube to run as a service. start seems to work:-
sudo /etc/init.d/sonar restart
Stopping SonarQube...
SonarQube was not running.
Starting SonarQube...
Started SonarQube.
but running status i get:-
sudo /etc/init.d/sonar status
SonarQube is not running.
looking in sonar.log i am getting the error above while loading the Wrapper:-
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
WrapperSimpleApp: Encountered an error running main:
java.lang.NoSuchMethodError:
ch.qos.logback.classic.LoggerContext.initCollisionMaps()V
java.lang.NoSuchMethodError:
ch.qos.logback.classic.LoggerContext.initCollisionMaps()V
at ch.qos.logback.classic.LoggerContext.reset(LoggerContext.java:222)
at org.sonar.application.AppLogging.configure(AppLogging.java:128)
at org.sonar.application.App.start(App.java:48)
at org.sonar.application.App.main(App.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
at java.lang.Thread.run(Thread.java:748)
Earlier errors where resolved as follows
Encountered an error running main: org.sonar.process.MessageException: Directory must contain only one JAR file
(removed /opt/sonar/lib/common/logback-classic-1.1.3.jar leaving /opt/sonar/lib/common/logback-classic-1.2.3.jar)
SLF4J: Class path contains multiple SLF4J bindings.re.org
SLF4J: Found binding in [jar:file:/opt/sonar/lib/common/logback-classic-
1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/sonar/lib/common/logback-classic-
1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/sonar/lib/sonar-application-
5.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.r!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]4j/impl/StaticLoggerBinder.class]
(removed the 1.1.3 version and the 5.6.6 one leaving 7 in the common folder)
Not sure what i can do at this point to get the wrapper to log, any ideas?
wrapper.conf contents
# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
wrapper.java.command=/usr/lib/jvm/java-8-oracle/bin/java
#
# DO NOT EDIT THE FOLLOWING SECTIONS
#
#********************************************************************
# Wrapper Java
#********************************************************************
wrapper.java.additional.1=-Dsonar.wrapped=true
wrapper.java.additional.2=-Djava.awt.headless=true
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.classpath.1=/opt/sonar/lib/jsw/*.jar
wrapper.java.classpath.2=/opt/sonar/lib/common/*.jar
wrapper.java.classpath.3=/opt/sonar/lib/*.jar
wrapper.java.library.path.1=./lib
wrapper.app.parameter.1=org.sonar.application.App
wrapper.java.initmemory=8
wrapper.java.maxmemory=32
#********************************************************************
# Wrapper Logs
#********************************************************************
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=/opt/sonar/logs/sonar.log
wrapper.logfile.format=M
wrapper.logfile.loglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=1m
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=10
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=SonarQube
# Disallow start of multiple instances of an application at the same time on Windows
wrapper.single_invocation=true
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=SonarQube
# Display name of the service
wrapper.ntservice.displayname=SonarQube
# Description of the service
wrapper.ntservice.description=SonarQube
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
#********************************************************************
# Forking Properties
#********************************************************************
wrapper.disable_restarts=TRUE
wrapper.ping.timeout=0
wrapper.shutdown.timeout=300
wrapper.jvm_exit.timeout=300
@G.Ann I believe I'm using v7.0 (sonar-application-7.0.jar) and I've renamed the version 5.6.6 version as sonar-application-5.6.6.jar.sanity
Additional: I've played with these java libraries and noticed the sonar-application-7.0.jar file seemed tiny so gone back to using 5.6.6 I have now noticed a different error in my log as follows:
WrapperSimpleApp: Encountered an error running main:
java.lang.NoSuchMethodError: org.sonar.application.AppFileSystem.<init>
(Lorg/sonar/process/Props;)V
java.lang.NoSuchMethodError: org.sonar.application.AppFileSystem.<init>
(Lorg/sonar/process/Props;)V
Google is not very forthcoming on this issue at all!
So i thought, I'll setup a new instance and see if i can get it running. I now do have SonarQube running (oddly this is not using a sonar user but the default user for this box) but it isn't loading in my browser (http://192.168.0.6:9000 remote or http://localhost:9000 on the local machine that has sonarqube installed in both cases we end with the Apache2 Ubuntu Default Page (ubuntu 16.04)
looking in the new error log for this instance i get the following error:
--> 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.
2018.02.27 12:35:04 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /home/eclipse-creative/sonarqube-5.6.6/temp
2018.02.27 12:35:04 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/home/eclipse-creative/sonarqube-5.6.6/temp -javaagent:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /home/eclipse-creative/sonarqube-5.6.6/temp/sq-process1825333712376294763properties
2018.02.27 12:35:04 INFO es[o.s.p.ProcessEntryPoint] Starting es
2018.02.27 12:35:04 INFO es[o.s.s.EsSettings] Elasticsearch listening on 127.0.0.1:9001
2018.02.27 12:35:04 INFO es[o.elasticsearch.node] [sonar-1519734904274] version[1.7.5], pid[17427], build[00f95f4/2016-02-02T09:55:30Z]
2018.02.27 12:35:04 INFO es[o.elasticsearch.node] [sonar-1519734904274] initializing ...
2018.02.27 12:35:04 INFO es[o.e.plugins] [sonar-1519734904274] loaded [], sites []
2018.02.27 12:35:04 INFO es[o.elasticsearch.env] [sonar-1519734904274] using [1] data paths, mounts [[/ (/dev/mapper/ubuntu--vg-root)]], net usable_space [191.1gb], net total_space [900.6gb], types [ext4]
2018.02.27 12:35:05 WARN es[o.e.bootstrap] JNA not found. native methods will be disabled.
2018.02.27 12:35:05 INFO es[o.elasticsearch.node] [sonar-1519734904274] initialized
2018.02.27 12:35:05 INFO es[o.elasticsearch.node] [sonar-1519734904274] starting ...
2018.02.27 12:35:06 INFO es[o.e.transport] [sonar-1519734904274] bound_address {inet[/127.0.0.1:9001]}, publish_address {inet[/127.0.0.1:9001]}
2018.02.27 12:35:06 INFO es[o.e.discovery] [sonar-1519734904274] sonarqube/5O-W5FA2RKyVQ9mwmwS25A
2018.02.27 12:35:09 INFO es[o.e.cluster.service] [sonar-1519734904274] new_master [sonar-1519734904274][5O-W5FA2RKyVQ9mwmwS25A][UbuntuServer6][inet[/127.0.0.1:9001]]{rack_id=sonar-1519734904274}, reason: zen-disco-join (elected_as_master)
2018.02.27 12:35:09 INFO es[o.elasticsearch.node] [sonar-1519734904274] started
2018.02.27 12:35:09 INFO es[o.e.gateway] [sonar-1519734904274] recovered [0] indices into cluster_state
2018.02.27 12:35:09 INFO app[o.s.p.m.Monitor] Process[es] is up
2018.02.27 12:35:09 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/home/eclipse-creative/sonarqube-5.6.6/temp -javaagent:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/home/eclipse-creative/sonarqube-5.6.6/lib/jdbc/mysql/mysql-connector-java-5.1.35.jar org.sonar.server.app.WebServer /home/eclipse-creative/sonarqube-5.6.6/temp/sq-process6145003752963374984properties
2018.02.27 12:35:09 INFO web[o.s.p.ProcessEntryPoint] Starting web
2018.02.27 12:35:09 INFO web[o.s.s.a.TomcatContexts] Webapp directory: /home/eclipse-creative/sonarqube-5.6.6/web
2018.02.27 12:35:10 INFO web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-192.168.0.6-9000"]
2018.02.27 12:35:10 ERROR web[o.a.c.h.Http11NioProtocol] Failed to initialize end point associated with ProtocolHandler ["http-nio-192.168.0.6-9000"]
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_161]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_161]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_161]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_161]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_161]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Connector.initInternal(Connector.java:960) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) [sonar-server-5.6.6.jar:na]
at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.6.jar:na]
at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
2018.02.27 12:35:10 ERROR web[o.a.c.c.StandardService] Failed to initialize connector [Connector[HTTP/1.1-9000]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-9000]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) [sonar-server-5.6.6.jar:na]
at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.6.jar:na]
at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:962) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
... 10 common frames omitted
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_161]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_161]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_161]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_161]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_161]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Connector.initInternal(Connector.java:960) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
... 11 common frames omitted
2018.02.27 12:35:10 WARN web[o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:na]
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:65) ~[sonar-server-5.6.6.jar:na]
at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) ~[sonar-process-5.6.6.jar:na]
at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) ~[sonar-server-5.6.6.jar:na]
... 3 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:575) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
... 8 common frames omitted
2018.02.27 12:35:10 INFO app[o.s.p.m.Monitor] Process[es] is stopping
2018.02.27 12:35:10 INFO es[o.s.p.StopWatcher] Stopping process
2018.02.27 12:35:10 INFO es[o.elasticsearch.node] [sonar-1519734904274] stopping ...
2018.02.27 12:35:10 INFO es[o.elasticsearch.node] [sonar-1519734904274] stopped
2018.02.27 12:35:10 INFO es[o.elasticsearch.node] [sonar-1519734904274] closing ...
2018.02.27 12:35:10 INFO es[o.elasticsearch.node] [sonar-1519734904274] closed
2018.02.27 12:35:11 INFO app[o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped
I'm using apache on this instance so unsure about why tomcat is referenced. my apache conf file for sonar is:
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>
ServerName 192.168.0.6/sonar
ServerAlias sonar.ecl
ServerAdmin c.stanfield@eclipse-creative.com
ProxyPreserveHost On
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
CustomLog /var/log/apache2/sonar.ecl_access.log common
ErrorLog /var/log/apache2/sonar.ecl_error.log
</VirtualHost>
Not even sure if i need reverse proxy here or not really?
Here's the scenario, we have jenkins running on this box and plan to use sonar to check code during it's deploy process the server is on our work intranet and is not outward facing (bar via ssh or such) We wish to be able to view the sonar results from a failed build (notify via slack which we have working via jenkins) so the user on another machine in our network would make a request to http://192.168.0.6:9000 to access sonar and see any issues preventing the deploy. This I would imagine is how most use sonar? java is not my strongpoint coming from a c++ and php background
Craig