2

我无法在 Windows Server 2012 或 Windows 10 上将 SonarQube 5.3 作为服务运行。它使用 StartSonar.bat 运行良好,但在安装并作为服务运行时出现错误

本地计算机上的 SonarQube 服务启动然后停止。如果某些服务没有被其他服务或程序使用,它们会自动停止。”

我尝试了具有本地管理员访问权限的特定服务用户和具有相同结果的“本地系统帐户”用户。

我已经测试了启动指定具有本地管理员访问权限的桌面用户的服务,这可以正常工作,但我们的策略是使用特定的服务用户进行服务。

我尝试过使用 JDK 8 64 位和 JDK 7 32 位,结果相同

sonar.log 的其他内容是

Using tick timer.
--> Wrapper Started as Service
server listening on port 32000.
Launching a JVM...
command: "C:\Program Files\Java\jdk1.8.0_72\bin\java.exe" -Djava.awt.headless=true -Xms3m -Xmx3m -Djava.library.path="./lib" -classpath "../../lib/jsw/wrapper-3.2.3.jar;../../lib/sonar-application-5.3.jar" -Dwrapper.key="Rfo5GpLfYyokZuoo" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=7932 -Dwrapper.version="3.2.3" -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.sonar.application.App
JVM started (PID=3388)
WrapperManager class initialized by thread: main  Using classloader: sun.misc.Launcher$AppClassLoader@5c647e05
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

Wrapper Manager: JVM #1
Running a 64-bit JVM.
Wrapper Manager: Registering shutdown hook
Wrapper Manager: Using wrapper
Load native library.  One or more attempts may fail if platform specific libraries do not exist.
Loading native library failed: wrapper-windows-x86-64.dll  Cause: java.lang.UnsatisfiedLinkError: no wrapper-windows-x86-64 in java.library.path
Loaded native library: wrapper.dll
Calling native initialization method.
Initializing WrapperManager native library.
Java Executable: C:\Program Files\Java\jdk1.8.0_72\bin\java.exe
Windows version: 6.3.9600
Java Version   : 1.8.0_72-b15 Java HotSpot(TM) 64-Bit Server VM
Java VM Vendor : Oracle Corporation

Control event monitor thread started.
Startup runner thread started.
WrapperManager.start(org.tanukisoftware.wrapper.WrapperSimpleApp@4f023edb, args[]) called by thread: main
Communications runner thread started.
Open socket to wrapper...Wrapper-Connection
Opened Socket from 31000 to 32000
Send a packet KEY : Rfo5GpLfYyokZuoo
handleSocket(Socket[addr=/127.0.0.1,port=32000,localport=31000])
accepted a socket from 127.0.0.1 on port 31000
read a packet KEY : Rfo5GpLfYyokZuoo
Got key from JVM: Rfo5GpLfYyokZuoo
send a packet LOW_LOG_LEVEL : 1
send a packet PING_TIMEOUT : 0
send a packet PROPERTIES : (Property Values)
Start Application.
send a packet START : start
Received a packet LOW_LOG_LEVEL : 1
Wrapper Manager: LowLogLevel from Wrapper is 1
Received a packet PING_TIMEOUT : 0
PingTimeout from Wrapper is 0
Received a packet PROPERTIES : (Property Values)
Received a packet START : start
calling WrapperListener.start()
Waiting for WrapperListener.start runner thread to complete.
WrapperListener.start runner thread started.
WrapperSimpleApp: start(args) Will wait up to 2 seconds for the main method to complete.
WrapperSimpleApp: invoking main method
Wrapper Manager: ShutdownHook started
WrapperManager.stop(0) called by thread: Wrapper-Shutdown-Hook
Send a packet STOP : 0
Startup runner thread stopped.
read a packet STOP : 0
JVM requested a shutdown. (0)
wrapperStopProcess(0) called.
Sending stop signal to JVM
send a packet STOP : NULL
Send a packet START_PENDING : 5000
read a packet START_PENDING : 5000
JVM signalled a start pending with waitHint of 5000 millis.
Thread, Wrapper-Shutdown-Hook, handling the shutdown process.
shutdownJVM(0) Thread:Wrapper-Shutdown-Hook
Send a packet STOPPED : 0
read a packet STOPPED : 0
JVM signalled that it was stopped.
Closing socket.
socket read no code (closed?).
server listening on port 32002.
Send a packet START_PENDING : 5000
Wrapper Manager: ShutdownHook complete
WrapperSimpleApp: start(args) end.  Main Completed=false, exitCode=null
WrapperListener.start runner thread stopped.
JVM process exited with a code of 0, leaving the wrapper exit code set to 0.
JVM exited normally.
<-- Wrapper Stopped
--> Wrapper Started as Service
Using tick timer.
server listening on port 32000.
Launching a JVM...
command: "C:\Program Files\Java\jdk1.8.0_72\bin\java.exe" -Djava.awt.headless=true -Xms3m -Xmx3m -Djava.library.path="./lib" -classpath "../../lib/jsw/wrapper-3.2.3.jar;../../lib/sonar-application-5.3.jar" -Dwrapper.key="dvwrESWxTion4Weh" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=4304 -Dwrapper.version="3.2.3" -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.sonar.application.App
JVM started (PID=376)
WrapperManager class initialized by thread: main  Using classloader: sun.misc.Launcher$AppClassLoader@5c647e05
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

Wrapper Manager: JVM #1
Running a 64-bit JVM.
Wrapper Manager: Registering shutdown hook
Wrapper Manager: Using wrapper
Load native library.  One or more attempts may fail if platform specific libraries do not exist.
Loading native library failed: wrapper-windows-x86-64.dll  Cause: java.lang.UnsatisfiedLinkError: no wrapper-windows-x86-64 in java.library.path
Loaded native library: wrapper.dll
Calling native initialization method.
Initializing WrapperManager native library.
Java Executable: C:\Program Files\Java\jdk1.8.0_72\bin\java.exe
Windows version: 6.3.9600
Java Version   : 1.8.0_72-b15 Java HotSpot(TM) 64-Bit Server VM
Java VM Vendor : Oracle Corporation

Control event monitor thread started.
Startup runner thread started.
WrapperManager.start(org.tanukisoftware.wrapper.WrapperSimpleApp@4f023edb, args[]) called by thread: main
Communications runner thread started.
Open socket to wrapper...Wrapper-Connection
Opened Socket from 31000 to 32000
Send a packet KEY : dvwrESWxTion4Weh
handleSocket(Socket[addr=/127.0.0.1,port=32000,localport=31000])
accepted a socket from 127.0.0.1 on port 31000
read a packet KEY : dvwrESWxTion4Weh
Got key from JVM: dvwrESWxTion4Weh
send a packet LOW_LOG_LEVEL : 1
send a packet PING_TIMEOUT : 0
send a packet PROPERTIES : (Property Values)
Start Application.
send a packet START : start
Received a packet LOW_LOG_LEVEL : 1
Wrapper Manager: LowLogLevel from Wrapper is 1
Received a packet PING_TIMEOUT : 0
PingTimeout from Wrapper is 0
Received a packet PROPERTIES : (Property Values)
Received a packet START : start
calling WrapperListener.start()
Waiting for WrapperListener.start runner thread to complete.
WrapperListener.start runner thread started.
WrapperSimpleApp: start(args) Will wait up to 2 seconds for the main method to complete.
WrapperSimpleApp: invoking main method
Wrapper Manager: ShutdownHook started
WrapperManager.stop(0) called by thread: Wrapper-Shutdown-Hook
Send a packet STOP : 0
Startup runner thread stopped.
read a packet STOP : 0
JVM requested a shutdown. (0)
wrapperStopProcess(0) called.
Sending stop signal to JVM
send a packet STOP : NULL
Send a packet START_PENDING : 5000
read a packet START_PENDING : 5000
JVM signalled a start pending with waitHint of 5000 millis.
Thread, Wrapper-Shutdown-Hook, handling the shutdown process.
shutdownJVM(0) Thread:Wrapper-Shutdown-Hook
Send a packet STOPPED : 0
read a packet STOPPED : 0
JVM signalled that it was stopped.
Closing socket.
socket read no code (closed?).
server listening on port 32002.
Send a packet START_PENDING : 5000
Wrapper Manager: ShutdownHook complete
WrapperSimpleApp: start(args) end.  Main Completed=false, exitCode=null
WrapperListener.start runner thread stopped.
JVM process exited with a code of 0, leaving the wrapper exit code set to 0.
JVM exited normally.
<-- Wrapper Stopped

当使用“StartSonar.bat”从控制台运行时,以下行会在声纳启动之前出现,而在作为服务运行时不会出现

WrapperSimpleApp: start(args) Will wait up to 2 seconds for the main method to complete.
WrapperSimpleApp: invoking main method
2016.02.09 09:14:11 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Program Files\Java\jdk1.8.0_72\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=D:\sonarqube-5.3\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Users\t8239\AppData\Local\Temp\sq-process7650225466698856396properties
2016.02.09 09:14:11 INFO   es[o.s.p.ProcessEntryPoint]  Starting search
2016.02.09 09:14:11 INFO   es[o.s.s.SearchSettings]  Elasticsearch listening on 127.0.0.1:9001

通过包装器启动声纳是否需要某种分叉特权?

4

3 回答 3

2

在本地添加 Windows 服务用户并赋予桌面交互权限后,我现在可以启动 SonarQube 服务。

于 2016-02-09T15:04:17.593 回答
0

将 SonarQube 服务配置为不使用本地系统帐户,而是使用具有更多权限的另一个用户。

请参阅
在 Windows 上将 SonarQube 作为服务运行
将 SonarQube 从 Tomcat 迁移到 Windows 服务

于 2016-02-11T10:46:11.470 回答
0

另一种不需要从 LocalSystem 更改用户或给予额外权限的解决方案java.execonf\wrapper.conf. 例子:

wrapper.java.command=C:\Program Files\Java\jdk1.8.0_144\bin\java.exe

andyd 的假设是包装器在分叉 Java 进程时失败,这正是我的情况所发生的,正如日志文件 (in logs\sonar.log) 中的一条错误消息所显示的那样。

由于公司密码策略需要每隔几周更改一次密码,因此在我的情况下,指定普通用户帐户不是一个实际的解决方案。

于 2018-01-02T11:16:10.957 回答