我正面临使用procrun将jetty作为服务运行的问题 在目标机器上我只有1.7 .0_67,我无法安装JDK 而且我在机器上没有JAVA_HOME 这是我的剧本:
@echo off
set SERVICE_NAME="Batch_Server"
set DISPLAY_NAME="Batch Server"
set DESCRIPTION="Batch Server"
set STOPKEY=stopkey
set STOPPORT=50001
set JETTY_JAVA_HOME=%MYAPP_HOME%\jre
set JETTY_HOME=%JETTY_HOME%
set JETTY_BASE=%JETTY_HOME%
set PR_INSTALL=%JETTY_HOME%\service-config\Batch Server.exe
set PR_INSTALL_NEW="%JETTY_HOME%\service-config\Batch Server.exe"
@REM Service Log Configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=%JETTY_HOME%\logs\service_logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=Debug
@REM Path to Java Installation
set PR_JVM=%JETTY_JAVA_HOME%\bin\server\jvm.dll
set PR_CLASSPATH=%JETTY_HOME%\start.jar
@REM JVM Configuration
set PR_JVMMS=2048
set PR_JVMMX=3072
set PR_JVMOPTIONS=-Duser.dir="%JETTY_BASE%";-Djetty.home="%JETTY_HOME%";- Djetty.base="%JETTY_BASE%"
set PR_JVMOPTIONS=%PR_JVMOPTIONS%;-XX:+PrintGCDetails;- XX:+PrintGCDateStamps;-XX:+UseGCLogFileRotation;-XX:+HeapDumpOnOutOfMemoryError
set PR_JVMOPTIONS=%PR_JVMOPTIONS%;-XX:NumberOfGCLogFiles=5;-XX:GCLogFileSize=100M;-Xloggc:%JETTY_HOME%/logs/jetty.gc;
@REM Startup Configuration
set JETTY_START_CLASS=org.eclipse.jetty.start.Main
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=%JETTY_START_CLASS%
set PR_STARTPARAMS=STOP.KEY="%STOPKEY%";STOP.PORT=%STOPPORT%
@REM Shutdown Configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=%JETTY_START_CLASS%
set PR_STOPPARAMS=-- stop;STOP.KEY="%STOPKEY%";STOP.PORT=%STOPPORT%;STOP.WAIT=10
REM %~1 removing any surrounding quotes (")
%~1%PR_INSTALL_NEW% //IS/%SERVICE_NAME% ^
--DisplayName=%DISPLAY_NAME% ^
--Description=%DESCRIPTION% ^
--Install="%PR_INSTALL%" ^
--Startup="%PR_STARTUP%" ^
--LogPath="%PR_LOGPATH%" ^
--LogPrefix="%PR_LOGPREFIX%" ^
--LogLevel="%PR_LOGLEVEL%" ^
--StdOutput="%PR_STDOUTPUT%" ^
--StdError="%PR_STDERROR%" ^
--Jvm="%PR_JVM%" ^
--JvmMs="%PR_JVMMS%" ^
--JvmMx="%PR_JVMMX%" ^
--JvmOptions="%PR_JVMOPTIONS%" ^
--Classpath="%PR_CLASSPATH%" ^
--StartMode="%PR_STARTMODE%" ^
--StartClass="%JETTY_START_CLASS%" ^
--StartParams="%PR_STARTPARAMS%" ^
--StopMode="%PR_STOPMODE%" ^
--StopClass="%PR_STOPCLASS%" ^
--StopParams="%PR_STOPPARAMS%"
if not errorlevel 1 goto installed
echo Failed to install %SERVICE_NAME% service. Refer to log in %PR_LOGPATH%
goto end
:installed
echo The Service %SERVICE_NAME% has been installed
:end
我收到错误:
2015-01-18 18:05:22 Commons Daemon procrun stderr initialized
java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(Unknown Source)
at org.eclipse.jetty.start.FS.toPath(FS.java:153)
at org.eclipse.jetty.start.config.CommandLineConfigSource.findJettyHomePath(CommandLineConfigSource.java:103)
at org.eclipse.jetty.start.config.CommandLineConfigSource.<init>(CommandLineConfigSource.java:60)
at org.eclipse.jetty.start.Main.processCommandLine(Main.java:589)
at org.eclipse.jetty.start.Main.main(Main.java:111)
Caused by: java.nio.file.InvalidPathException: Illegal char <"> at index 0: "C:\Program Files (x86)\myapp\Data-Batch-Server"
at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at sun.nio.fs.WindowsFileSystem.<init>(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.<init>(Unknown Source)
at sun.nio.fs.DefaultFileSystemProvider.create(Unknown Source)
at java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(Unknown Source)
at java.nio.file.FileSystems$DefaultFileSystemHolder.access$000(Unknown Source)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(Unknown Source)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.file.FileSystems$DefaultFileSystemHolder.defaultFileSystem(Unknown Source)
at java.nio.file.FileSystems$DefaultFileSystemHolder.<clinit>(Unknown Source)
... 6 more
Usage: java -jar start.jar [options] [properties] [configs]
java -jar start.jar --help # for more information
我做错了什么,请帮忙
答案 0 :(得分:2)
当我按照本页面上的说明操作时,我将jetty作为Windows服务运行: Startup via Windows Service
错误看起来像路径中的空白有问题。你能尝试使用8.3文件名而不是长名吗?
给定的启动文件中有相当多的空白,它似乎不是你实际使用的那个,因为它不会在没有删除空白的情况下工作,即在PR_JVMOPTIONS变量中。
您可以发布您使用的实际内容吗?