I can't run sonar in my ubuntu

sonarqube

(João Victor) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

I have installed the sonarqube 6.0 in my computer (ubuntu 16.04).

When I run the ./sonar.sh console the application returns this:

Running SonarQube...
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    | 2018.09.04 11:15:26 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
jvm 1    | 2018.09.04 11:15:26 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /opt/bitnami/java/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonar/temp -javaagent:/opt/bitnami/java/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonar/temp/sq-process1751799790689480405properties
jvm 1    | 2018.09.04 11:15:32 INFO  app[o.s.p.m.Monitor] Process[es] is up
jvm 1    | 2018.09.04 11:15:32 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /opt/bitnami/java/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonar/temp -javaagent:/opt/bitnami/java/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/opt/sonar/lib/jdbc/mysql/mysql-connector-java-5.1.39.jar org.sonar.server.app.WebServer /opt/sonar/temp/sq-process4466289284288464018properties
jvm 1    | 2018.09.04 11:15:35 INFO  app[o.s.p.m.Monitor] Process[es] is stopping
jvm 1    | 2018.09.04 11:15:36 INFO  app[o.s.p.m.Monitor] Process[es] is stopped
wrapper  | <-- Wrapper Stopped

When I run the application ./sonar.sh start returns:

Starting SonarQube…
Started SonarQube.

I’ve install the mySql database, and guarantee thee privileges for my user, but isn’t work.

What’s wrong?


(Julien Lancelot) #2

Hi,

Could you please provide the logs from {SONAR_QUBE}/logs folder ?

Moreover, I would encourage you to migrate to the latest LTS, 6.7.

Regards


(João Victor) #3

Here

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

2018.09.04 11:15:26 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2018.09.04 11:15:26 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /opt/bitnami/java/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonar/temp -javaagent:/opt/bitnami/java/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonar/temp/sq-process1751799790689480405properties
2018.09.04 11:15:26 INFO   es[o.s.p.ProcessEntryPoint]  Starting es
2018.09.04 11:15:27 INFO   es[o.s.s.EsSettings]  Elasticsearch listening on /127.0.0.1:9001
2018.09.04 11:15:27 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] version[2.3.3], pid[25343], build[218bdf1/2016-05-17T15:40:04Z]
2018.09.04 11:15:27 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] initializing ...
2018.09.04 11:15:27 INFO   es[o.e.plugins]  [sonar-1536070526290] modules [], plugins [], sites []
2018.09.04 11:15:27 INFO   es[o.elasticsearch.env]  [sonar-1536070526290] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [7.8gb], net total_space [19.3gb], spins? [no], types [ext4]
2018.09.04 11:15:27 INFO   es[o.elasticsearch.env]  [sonar-1536070526290] heap size [1007.3mb], compressed ordinary object pointers [true]
2018.09.04 11:15:28 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] initialized
2018.09.04 11:15:28 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] starting ...
2018.09.04 11:15:28 INFO   es[o.e.transport]  [sonar-1536070526290] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2018.09.04 11:15:28 INFO   es[o.e.discovery]  [sonar-1536070526290] sonarqube/4AAUL_qxRfG3FEH-kXiNdQ
2018.09.04 11:15:31 INFO   es[o.e.cluster.service]  [sonar-1536070526290] new_master {sonar-1536070526290}{4AAUL_qxRfG3FEH-kXiNdQ}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonar-1536070526290}, reason: zen-disco-join(elected_as_master, [0] joins received)
2018.09.04 11:15:31 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] started
2018.09.04 11:15:32 INFO   es[o.e.gateway]  [sonar-1536070526290] recovered [0] indices into cluster_state
2018.09.04 11:15:32 INFO  app[o.s.p.m.Monitor] Process[es] is up
2018.09.04 11:15:32 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /opt/bitnami/java/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonar/temp -javaagent:/opt/bitnami/java/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/opt/sonar/lib/jdbc/mysql/mysql-connector-java-5.1.39.jar org.sonar.server.app.WebServer /opt/sonar/temp/sq-process4466289284288464018properties
2018.09.04 11:15:32 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2018.09.04 11:15:33 INFO  web[o.s.s.a.TomcatContexts] Webapp directory: /opt/sonar/web
2018.09.04 11:15:33 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2018.09.04 11:15:33 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2018.09.04 11:15:33 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 6.0 / 93442889cd219e78b028c7dcf51a30de74c987fe
2018.09.04 11:15:33 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
Tue Sep 04 11:15:33 BRT 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2018.09.04 11:15:34 ERROR web[o.a.c.c.C.[.[.[/sonar]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
        at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:104) ~[sonar-db-6.0.jar:na]
        at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:71) ~[sonar-db-6.0.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.15.jar:na]
        at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320) ~[sonar-core-6.0.jar:na]
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) ~[picocontainer-2.15.jar:na]
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) ~[sonar-core-6.0.jar:na]
 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) ~[picocontainer-2.15.jar:na]
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) ~[picocontainer-2.15.jar:na]
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) ~[sonar-core-6.0.jar:na]
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:84) ~[sonar-server-6.0.jar:na]
        at org.sonar.server.platform.Platform.start(Platform.java:216) ~[sonar-server-6.0.jar:na]
        at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:175) ~[sonar-server-6.0.jar:na]
        at org.sonar.server.platform.Platform.init(Platform.java:90) ~[sonar-server-6.0.jar:na]
        at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-6.0.jar:na]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [tomcat-embed-core-8.0.32.jar:8.0.32]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [tomcat-embed-core-8.0.32.jar:8.0.32]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [tomcat-embed-core-8.0.32.jar:8.0.32]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [tomcat-embed-core-8.0.32.jar:8.0.32]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [tomcat-embed-core-8.0.32.jar:8.0.32]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_161]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'sonarqube'@'localhost' (using password: YES))
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
        at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31) ~[sonar-db-6.0.jar:na]
        at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323) ~[sonar-db-6.0.jar:na]
        at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:102) ~[sonar-db-6.0.jar:na]
        ... 30 common frames omitted
Caused by: java.sql.SQLException: Access denied for user 'sonarqube'@'localhost' (using password: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:875) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1712) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1228) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_161]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_161]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_161]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_161]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328) ~[mysql-connector-java-5.1.39.jar:5.1.39]
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
        ... 35 common frames omitted
2018.09.04 11:15:34 ERROR web[o.a.c.c.StandardContext] One or more listeners failed to start. Full details will be found in the appropriate container log file
2018.09.04 11:15:34 ERROR web[o.a.c.c.StandardContext] Context [/sonar] startup failed due to previous errors
2018.09.04 11:15:34 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [sonar] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2018.09.04 11:15:34 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [sonar] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.util.TimerThread.mainLoop(Timer.java:552)
 java.util.TimerThread.run(Timer.java:505)
2018.09.04 11:15:34 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2018.09.04 11:15:34 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2018.09.04 11:15:34 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2018.09.04 11:15:34 WARN  web[o.s.p.ProcessEntryPoint] Fail to start web
java.lang.IllegalStateException: Webapp did not start
        at org.sonar.server.app.EmbeddedTomcat.isUp(EmbeddedTomcat.java:84) ~[sonar-server-6.0.jar:na]
        at org.sonar.server.app.WebServer.isUp(WebServer.java:47) [sonar-server-6.0.jar:na]
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:105) ~[sonar-process-6.0.jar:na]
        at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-6.0.jar:na]
2018.09.04 11:15:34 INFO  web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2018.09.04 11:15:35 INFO  web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]
2018.09.04 11:15:35 INFO  web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]
2018.09.04 11:15:35 INFO  web[o.s.s.a.TomcatAccessLog] Web server is stopped
2018.09.04 11:15:35 INFO  app[o.s.p.m.Monitor] Process[es] is stopping
2018.09.04 11:15:35 INFO   es[o.s.p.StopWatcher]  Stopping process
2018.09.04 11:15:35 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] stopping ...
2018.09.04 11:15:35 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] stopped
2018.09.04 11:15:35 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] closing ...
2018.09.04 11:15:35 INFO   es[o.elasticsearch.node]  [sonar-1536070526290] closed
2018.09.04 11:15:36 INFO  app[o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped

(Nicolas Bontoux) #4

Hi,

There’s a pretty clear error log in what you just shared:

java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by ‘sonar.jdbc.’).

Caused by: java.sql.SQLException: Access denied for user ‘sonarqube’@‘localhost’ (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963) ~[mysql-connector-java-5.1.39.jar:5.1.39]

Did you troubleshoot this ? Seems like SonarQube can’t connect with the database URL and credentials you provided. You might want to first try connecting with a simply MySQL client (using same URL/credentials), to diagnose this at MySQL level.


(João Victor) #5

Hi Nico, now I migrate my server to postgreeSql and the applications is running, but i can’t acess the url.

What can I do?


(Nicolas Bontoux) #6

I suggest you start by looking at the overall logs and understand if any issue (see Troubleshooting notes). Then check URL first locally, and then remotely. Finally you can raise a separate topic if any issue remains mysterious.