sonarqube安装报错

小久哥阿 发布于 2016/08/05 16:18
阅读 4K+
收藏 0

研究两天了,Sonarqubeweb还上不去,求各位大神帮帮我这个小白

OS:linux Ret Hat 6.8

设置的环境变量:(此环境变量是根据网络上文档定义的)

export JAVA_HOME=/usr/local/java/jdk1.7.0_80
export JRE_HOME=/usr/local/java/jdk1.7.0_80/jre
export PATH=$PATH:/usr/local/java/jdk1.7.0_80/bin
export CLASSPATH=./:/usr/local/java/jdk1.7.0_80/bin:/usr/local/java/jdk1.7.0_80/jre/lib
export  SONAR_HOME=/usr/local/sonarqube-5.5

JDK版本: java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode

MySql版本:
# mysql -V mysql Ver
mysql  Ver 14.14 Distrib 5.7.14, for Linux (x86_64) using  EditLine wrapper

sonar.properties的配置

sonar.jdbc.username=    sonar

sonar.jdbc.password=    sonar

 

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

sonar.web.port=9000

现象:

下面是日志--> 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.


2016.08.04 23:44:05 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /usr/local/sonarqube-5.5/temp
2016.08.04 23:44:05 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/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=/usr/local/sonarqube-5.5/temp -javaagent:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /tmp/sq-process3488650662545748053properties
2016.08.04 23:44:06 INFO   es[o.s.p.ProcessEntryPoint]  Starting es
2016.08.04 23:44:07 INFO   es[o.s.s.EsSettings]  Elasticsearch listening on 127.0.0.1:9001
2016.08.04 23:44:07 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] version[1.7.5], pid[10492], build[00f95f4/2016-02-02T09:55:30Z]
2016.08.04 23:44:07 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] initializing ...
2016.08.04 23:44:07 INFO   es[o.e.plugins]  [sonar-1470325445297] loaded [], sites []
2016.08.04 23:44:07 INFO   es[o.elasticsearch.env]  [sonar-1470325445297] using [1] data paths, mounts [[/ (/dev/mapper/vg_study-lv_root)]], net usable_space [41.4gb], net total_space [49gb], types [ext4]
2016.08.04 23:44:10 WARN   es[o.e.bootstrap]  JNA not found. native methods will be disabled.
2016.08.04 23:44:12 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] initialized
2016.08.04 23:44:12 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] starting ...
2016.08.04 23:44:12 INFO   es[o.e.transport]  [sonar-1470325445297] bound_address {inet[/127.0.0.1:9001]}, publish_address {inet[/127.0.0.1:9001]}
2016.08.04 23:44:12 INFO   es[o.e.discovery]  [sonar-1470325445297] sonarqube/cptRmHUiROekXI1drTI39w
2016.08.04 23:44:15 INFO   es[o.e.cluster.service]  [sonar-1470325445297] new_master [sonar-1470325445297][cptRmHUiROekXI1drTI39w][study.wan.com][inet[/127.0.0.1:9001]]{rack_id=sonar-1470325445297}, reason: zen-disco-join (elected_as_master)
2016.08.04 23:44:16 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] started
2016.08.04 23:44:16 INFO   es[o.e.gateway]  [sonar-1470325445297] recovered [0] indices into cluster_state
2016.08.04 23:44:16 INFO  app[o.s.p.m.Monitor] Process[es] is up
2016.08.04 23:44:16 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/usr/local/sonarqube-5.5/temp -javaagent:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/usr/local/sonarqube-5.5/lib/jdbc/mysql/mysql-connector-java-5.1.35.jar org.sonar.server.app.WebServer /tmp/sq-process6527392485341257548properties
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=160m; support was removed in 8.0
2016.08.04 23:44:17 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2016.08.04 23:44:18 INFO  web[o.s.s.a.TomcatContexts] Webapp directory: /usr/local/sonarqube-5.5/web
2016.08.04 23:44:19 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.08.04 23:44:19 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2016.08.04 23:44:21 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.5 / 5773a4aab0ef6c0de79d3038e82f8a051049d6d0
2016.08.04 23:44:21 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
2016.08.04 23:44:22 ERROR web[o.a.c.c.C.[.[.[/]] 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-5.5.jar:na]
        at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:71) ~[sonar-db-5.5.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
        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-5.5.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-5.5.jar:na]
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:84) ~[sonar-server-5.5.jar:na]
        at org.sonar.server.platform.Platform.start(Platform.java:216) ~[sonar-server-5.5.jar:na]
        at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:175) ~[sonar-server-5.5.jar:na]
        at org.sonar.server.platform.Platform.init(Platform.java:90) ~[sonar-server-5.5.jar:na]
        at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-5.5.jar:na]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [tomcat-embed-core-8.0.30.jar:8.0.30]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [tomcat-embed-core-8.0.30.jar:8.0.30]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.30.jar:8.0.30]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [tomcat-embed-core-8.0.30.jar:8.0.30]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [tomcat-embed-core-8.0.30.jar:8.0.30]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure


The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
        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-5.5.jar:na]
        at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323) ~[sonar-db-5.5.jar:na]
        at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:102) ~[sonar-db-5.5.jar:na]
        ... 30 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_91]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_91]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_91]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_91]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:389) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2237) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_91]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_91]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_91]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_91]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:389) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        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
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_91]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_91]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_91]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_91]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_91]
        at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_91]
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:213) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297) ~[mysql-connector-java-5.1.35.jar:5.1.35]
        ... 51 common frames omitted
2016.08.04 23:44:22 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
2016.08.04 23:44:22 ERROR web[o.a.c.c.StandardContext] Context [] startup failed due to previous errors
2016.08.04 23:44:22 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] 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)
2016.08.04 23:44:22 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] 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)
2016.08.04 23:44:23 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.08.04 23:44:23 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2016.08.04 23:44:23 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2016.08.04 23:44:23 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-5.5.jar:na]
        at org.sonar.server.app.WebServer.isUp(WebServer.java:48) [sonar-server-5.5.jar:na]
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:105) ~[sonar-process-5.5.jar:na]
        at org.sonar.server.app.WebServer.main(WebServer.java:69) [sonar-server-5.5.jar:na]
2016.08.04 23:44:23 INFO  web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.08.04 23:44:24 INFO  web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.08.04 23:44:24 INFO  web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.08.04 23:44:24 INFO  web[o.s.s.a.TomcatAccessLog] Web server is stopped
2016.08.04 23:44:24 INFO  app[o.s.p.m.Monitor] Process[es] is stopping
2016.08.04 23:44:24 INFO   es[o.s.p.StopWatcher]  Stopping process
2016.08.04 23:44:24 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] stopping ...
2016.08.04 23:44:25 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] stopped
2016.08.04 23:44:25 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] closing ...
2016.08.04 23:44:25 INFO   es[o.elasticsearch.node]  [sonar-1470325445297] closed
2016.08.04 23:44:25 INFO  app[o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped


 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:mysql://192.168.1.100:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

原因发现是sonar链接不上数据库,导致链接是失败。但是我 mysql -u sonar -p 是可以链接数据库的,请指教

 

加载中
0
小久哥阿
小久哥阿
另外,我办sonar配置文件中的mysql地址换成本机IP地址,还是连接失败
0
12叔
12叔
使用Docker 一键运行 
docker run -d --restart=always  --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube



小久哥阿
小久哥阿
-bash: docker: command not found 还需要我下载个什么软件吗
小久哥阿
小久哥阿
我现在在想,是不是因为我sonarqube和mysql装在一台机器上的问题。docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube 执行这条命令是吧?
0
非常路过
非常路过

有指定sonar.jdbc.driverClassName吗。

或者有没有复制对应的driver到lib目录。

或者数据库对应的driver版本是不是对的。

或者是不是防火墙,直接执行mysql命令不是通过端口访问的。

小久哥阿
小久哥阿
我之前是mysql和Sonarqube,放在了一台主机上,现在我在另外一台主机上搭建了MySql5.7,可以访问localhost:9000。问题是得到了解决,但是还是不太明白为什么这两天服务不能放在一台主机上。
0
chuckpu
chuckpu
应该是没有指定jdbc driver
小久哥阿
小久哥阿
问题已经解决。感谢
0
j
johnny2013
解决了不总结和提供解决方案,这不是好习惯。
帮提问人总结一下解决方案:
D:\work2\sonarqube-6.1\conf\sonar.properties 文件中,除了
sonar.jdbc.username=    sonar
sonar.jdbc.password=    sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.web.port=9000 
还需要增加一行:
sonar.jdbc.driverClassName=org.gjt.mm.mysql.Driver
即启动成功。
另外,
启动时候的详细输出: D:\work2\sonarqube-6.1\logs\sonar.log
mysql的jdbc驱动自带,见 D:\work2\sonarqube-6.1\lib\jdbc\mysql\mysql-connector-java-5.1.39.jar

小久哥阿
小久哥阿
回复@johnny2013 : 感谢提醒,下次我注意!~
返回顶部
顶部