SonarQube无法启动:StartSonar.bat

时间:2017-01-12 12:51:49

标签: sonarqube sonar-runner sonarqube-5.4

Iam尝试从命令行运行StartSonar.bat以启动声纳服务,但它给了我以下异常。它似乎与内存问题或Java版本问题有关,但我无法找到根本原因。感谢任何帮助。

Sonarqube版本是 - 5.4 声纳扫描仪版本 - 2.6.1

下面的日志文件。

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

2017.01.12 18:30:42 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory C:\Users\502698332\Downloads\Code Review\sonarqube-5.4\sonarqube-5.4\temp
2017.01.12 18:30:42 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Program Files\Java\jre1.8.0_112\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=C:\Users\502698332\Downloads\Code Review\sonarqube-5.4\sonarqube-5.4\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Users\502698~1\AppData\Local\Temp\sq-process506451527421407979properties
2017.01.12 18:30:43 INFO   es[o.s.p.ProcessEntryPoint]  Starting search
2017.01.12 18:30:43 INFO   es[o.s.s.SearchSettings]  Elasticsearch listening on 127.0.0.1:9001
2017.01.12 18:30:43 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] version[1.7.2], pid[12896], build[e43676b/2015-09-14T09:49:53Z]
2017.01.12 18:30:43 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] initializing ...
2017.01.12 18:30:43 INFO   es[o.e.plugins]  [sonar-1484226042365] loaded [], sites []
2017.01.12 18:30:43 INFO   es[o.elasticsearch.env]  [sonar-1484226042365] using [1] data paths, mounts [[Windows7 (C:)]], net usable_space [379.4gb], net total_space [465.7gb], types [NTFS]
2017.01.12 18:30:44 WARN   es[o.e.bootstrap]  JNA not found. native methods will be disabled.
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] initialized
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] starting ...
2017.01.12 18:30:44 WARN   es[o.s.p.ProcessEntryPoint]  Fail to start search
org.elasticsearch.transport.BindTransportException: Failed to bind to [9001]
    at org.elasticsearch.transport.netty.NettyTransport.bindServerBootstrap(NettyTransport.java:422) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:283) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.transport.TransportService.doStart(TransportService.java:153) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:257) ~[elasticsearch-1.7.2.jar:na]
    at org.sonar.search.SearchServer.start(SearchServer.java:45) [sonar-search-5.4.jar:na]
    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81) ~[sonar-process-5.4.jar:na]
    at org.sonar.search.SearchServer.main(SearchServer.java:79) [sonar-search-5.4.jar:na]
Caused by: org.elasticsearch.common.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:9001
    at org.elasticsearch.common.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.transport.netty.NettyTransport$1.onPortNumber(NettyTransport.java:413) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:58) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.transport.netty.NettyTransport.bindServerBootstrap(NettyTransport.java:409) ~[elasticsearch-1.7.2.jar:na]
    ... 8 common frames omitted
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_112]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_112]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_112]
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[na:1.8.0_112]
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[na:1.8.0_112]
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) ~[elasticsearch-1.7.2.jar:na]
    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ~[elasticsearch-1.7.2.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:1.8.0_112]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:1.8.0_112]
    at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_112]
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] stopping ...
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] stopped
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] closing ...
2017.01.12 18:30:44 INFO   es[o.elasticsearch.node]  [sonar-1484226042365] closed
<-- Wrapper Stopped

2 个答案:

答案 0 :(得分:1)

错误非常明确:

org.elasticsearch.transport.BindTransportException: Failed to bind to [9001]
...
Caused by: java.net.BindException: Address already in use: bind

SonarQube无法使用端口9001。也许另一个SonarQube实例已经在使用它,也许还有一些其他/僵尸进程。有关如何使用Windows上的特定端口识别进程的指导,请参阅this StackOverflow question

来自他们的解决方案:

  • 处理已经在端口9001上监听的流程

  • 告诉您的SonarQube服务器在 sonar.properties sonar.properties中侦听不同的端口: sonar.web.port sonar.search.port EM>

答案 1 :(得分:0)

有时,无法通过端口 (9001) 停止当前正在运行的应用程序。那可能正在运行任何与系统相关的操作。 不是禁用现有应用程序,而是需要将 SonarQube 的端口从 9001 更改为其他。

例如, 在 sonar.properties 中 将此行“#sonar.search.port=9001”更改为“sonar.search.port=9002” (这对我有用)