无法访问SonarQube服务器页面

时间:2017-03-08 09:07:23

标签: jenkins centos sonarqube jenkins-plugins

我在CentOS机器上安装了SonarQube 5.6.6。在运行命令sudo /etc/init.d/sonar start时,我在控制台上收到一条消息,说服务器已启动。但是,我无法通过点击URL访问服务器。它说"网页不可用"。这是启动服务器后的日志文件:

--> 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.

2017.03.08 03:46:10 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/sonarqube-5.6.6/temp
2017.03.08 03:46:10 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /opt/java/jdk1.8.0_45/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=/opt/sonar/sonarqube-5.6.6/temp -javaagent:/opt/java/jdk1.8.0_45/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonar/sonarqube-5.6.6/temp/sq-process7136923572720376635properties
2017.03.08 03:46:11 INFO   es[o.s.p.ProcessEntryPoint]  Starting es
2017.03.08 03:46:11 INFO   es[o.s.s.EsSettings]  Elasticsearch listening on 127.0.0.1:9001
2017.03.08 03:46:11 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] version[1.7.5], pid[27750], build[00f95f4/2016-02-02T09:55:30Z]
2017.03.08 03:46:11 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] initializing ...
2017.03.08 03:46:11 INFO   es[o.e.plugins]  [sonar-1488962770197] loaded [], sites []
2017.03.08 03:46:11 INFO   es[o.elasticsearch.env]  [sonar-1488962770197] using [1] data paths, mounts [[/ (/dev/mapper/vg_gendc-lv_root)]], net usable_space [33.7gb], net total_space [49gb], types [ext4]
2017.03.08 03:46:12 WARN   es[o.e.bootstrap]  JNA not found. native methods will be disabled.
2017.03.08 03:46:13 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] initialized
2017.03.08 03:46:13 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] starting ...
2017.03.08 03:46:13 WARN   es[o.e.common.network]  failed to resolve local host, fallback to loopback
java.net.UnknownHostException: GENDC: GENDC: unknown error
        at java.net.InetAddress.getLocalHost(InetAddress.java:1484) ~[na:1.8.0_45]
        at org.elasticsearch.common.network.NetworkUtils.<clinit>(NetworkUtils.java:55) ~[elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.transport.netty.NettyTransport.createClientBootstrap(NettyTransport.java:350) [elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:242) [elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) [elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.transport.TransportService.doStart(TransportService.java:153) [elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) [elasticsearch-1.7.5.jar:na]
        at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:257) [elasticsearch-1.7.5.jar:na]
        at org.sonar.search.SearchServer.start(SearchServer.java:46) [sonar-search-5.6.6.jar:na]
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.6.jar:na]
        at org.sonar.search.SearchServer.main(SearchServer.java:81) [sonar-search-5.6.6.jar:na]
Caused by: java.net.UnknownHostException: GENDC: unknown error
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_45]
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:907) ~[na:1.8.0_45]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1302) ~[na:1.8.0_45]
        at java.net.InetAddress.getLocalHost(InetAddress.java:1479) ~[na:1.8.0_45]
        ... 10 common frames omitted
2017.03.08 03:46:13 INFO   es[o.e.transport]  [sonar-1488962770197] bound_address {inet[/127.0.0.1:9001]}, publish_address {inet[/127.0.0.1:9001]}
2017.03.08 03:46:13 INFO   es[o.e.discovery]  [sonar-1488962770197] sonarqube/uDS8_ZL_Q_yEh-Rl-cxzrA
2017.03.08 03:46:16 INFO   es[o.e.cluster.service]  [sonar-1488962770197] new_master [sonar-1488962770197][uDS8_ZL_Q_yEh-Rl-cxzrA][localhost][inet[/127.0.0.1:9001]]{rack_id=sonar-1488962770197}, reason: zen-disco-join (elected_as_master)
2017.03.08 03:46:16 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] started
2017.03.08 03:46:16 INFO   es[o.e.gateway]  [sonar-1488962770197] recovered [0] indices into cluster_state
2017.03.08 03:46:16 INFO  app[o.s.p.m.Monitor] Process[es] is up
2017.03.08 03:46:16 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /opt/java/jdk1.8.0_45/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=/opt/sonar/sonarqube-5.6.6/temp -javaagent:/opt/java/jdk1.8.0_45/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/opt/sonar/sonarqube-5.6.6/lib/jdbc/mysql/mysql-connector-java-5.1.35.jar org.sonar.server.app.WebServer /opt/sonar/sonarqube-5.6.6/temp/sq-process159399378215612918properties
2017.03.08 03:46:16 INFO  web[o.s.p.ProcessEntryPoint] Starting web

如果我尝试通过此链接访问服务器页面:http://localhost:9000/sonar,网页不可用,并且在尝试停止时,我收到一条控制台消息:&#34; SonarQube未运行&#34; 。但是,如果我在点击URL之前尝试停止它,则控制台消息为:&#34;停止SonarQube&#34;。这似乎很奇怪。

停止服务器后,日志文件的其余部分如下:

2017.03.08 03:46:16 INFO  web[o.s.s.a.TomcatContexts] Webapp directory: /opt/sonar/sonarqube-5.6.6/web
2017.03.08 03:46:17 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-172.31.254.181-80"]
2017.03.08 03:46:17 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2017.03.08 03:46:26 INFO  web[o.a.c.u.SessionIdGeneratorBase] Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [9,101] milliseconds.
2017.03.08 03:46:26 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.6.6 / e8e13145497bb920921ae4fe11b09f0903f1d298
2017.03.08 03:46:26 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
2017.03.08 03:46:26 ERROR web[o.a.c.c.C.[.[.[/sonar]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
org.sonar.api.utils.MessageException: Unsupported mysql version: 5.1. Minimal supported version is 5.6.
2017.03.08 03:46:26 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
2017.03.08 03:46:26 ERROR web[o.a.c.c.StandardContext] Context [/sonar] startup failed due to previous errors
2017.03.08 03:46:26 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)
2017.03.08 03:46:26 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)
2017.03.08 03:46:26 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-172.31.254.181-80"]
2017.03.08 03:46:26 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2017.03.08 03:46:26 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 80
2017.03.08 03:46:26 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.6.6.jar:na]
        at org.sonar.server.app.WebServer.isUp(WebServer.java:47) [sonar-server-5.6.6.jar:na]
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:105) ~[sonar-process-5.6.6.jar:na]
        at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
2017.03.08 03:46:26 INFO  web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-172.31.254.181-80"]
2017.03.08 03:46:27 INFO  web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-172.31.254.181-80"]
2017.03.08 03:46:28 INFO  web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-172.31.254.181-80"]
2017.03.08 03:46:28 INFO  web[o.s.s.a.TomcatAccessLog] Web server is stopped
2017.03.08 03:46:28 INFO  app[o.s.p.m.Monitor] Process[es] is stopping
2017.03.08 03:46:28 INFO   es[o.s.p.StopWatcher]  Stopping process
2017.03.08 03:46:28 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] stopping ...
2017.03.08 03:46:28 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] stopped
2017.03.08 03:46:28 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] closing ...
2017.03.08 03:46:28 INFO   es[o.elasticsearch.node]  [sonar-1488962770197] closed
2017.03.08 03:46:29 INFO  app[o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped  

这是我在sonar.properties文件中编写的一些属性:

  

sonar.web.host = 172.31.254.181 sonar.web.context = / sonar   sonar.web.port = 9000 sonar.jdbc.username =声纳   sonar.jdbc.password =声纳   ?sonar.jdbc.url = JDBC:MySQL的://本地主机:3306 /声纳了useUnicode =真安培;的characterEncoding = UTF8&安培; rewriteBatchedStatements =真安培; useConfigs = maxPerformance

任何帮助整理此问题都将不胜感激。

1 个答案:

答案 0 :(得分:4)

您的SonarQube服务器实际上无法启动。并且错误就在您共享的日志中:

  

2017.03.08 03:46:26 ERROR web [o.a.c.c.C。[。[。[/ sonar]]将上下文初始化事件发送到类org.sonar.server.platform.PlatformServletContextListener的侦听器实例的异常    org.sonar.api.utils.MessageException:不支持的mysql版本:5.1。支持的最低版本为5.6。

SonarQube v5.6.x要求为here,而对于MySQL,仅支持版本5.6或5.7(就像日志所述)。