将Jetty 7作为Windows服务运行 [英] Running Jetty 7 as Windows Service

查看:122
本文介绍了将Jetty 7作为Windows服务运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jetty 7是否放弃了使用Java Service Wrapper作为服务运行的支持? 我现在有什么选择?

Did Jetty 7 drop support to run as a service using Java Service Wrapper? What options do I have now?

推荐答案

@glb,感谢您指出apache commons-daemon Procrun.
在Windows 7 64位上,它对我来说很棒,这就是我的设置方法.

@glb, thanks for pointing out apache commons-daemon Procrun.
Its working great for me on Windows 7 64 Bit, here's how I set it up.

有关更多信息,请参见

  • procrun 页(根据@glb的链接
  • )
  • jetty帮助屏幕> java -jar start.jar --help
  • procrun page as per link from @glb
  • jetty help screen > java -jar start.jar --help
REM 1. Open command prompt as Administrator

mkdir C:\java\apache-commons-daemon
REM 2. Download commons-daemon binaries for windows to directory above from
REM      http://www.apache.org/dist/commons/daemon/binaries/windows/commons-daemon-1.0.15-bin-windows.zip
REM 3. unzip which will create C:\java\apache-commons-daemon\commons-daemon-1.0.5-bin-windows

mkdir C:\java\jetty
REM 4. Download jetty to directory above from
REM      http://download.eclipse.org/jetty/7.4.2.v20110526/dist/jetty-distribution-7.4.2.v20110526.zip 
REM 5. install / unzip which will create C:\java\jetty\jetty-distribution-7.4.2.v20110526

REM 6. Verify that jetty can be started
cd C:\java\jetty\jetty-distribution-7.4.2.v20110526
java -jar start.jar
REM     Look for any obvious errors on the console
REM     Open a browser at http://localhost:8080/
REM     You should be presented with the Jetty Start Page,
REM      and be able to execute the Hello World Servlet
REM     OK, that's enough,
REM      come back to the command prompt and ctrl-C to stop the jetty server

REM 7. Copy and rename commons-daemon binaries into the JETTY_HOME directory structure
REM     Note that the GUI manager is copied to JETTY_HOME,
REM      and the service exe is copied to JETTY_HOME\bin
REM     Note that both binaries get the same target name,
REM      but are placed in different directories
REM     This is just makes it easier to launch the GUI manager
REM      by not having to provide command line arguments
REM     Note that I have selected the amd64\prunsrv.exe as the service exe,
REM      I am running on Windows 7 64 bit Intel i7 Xeon
cd C:\java\jetty\jetty-distribution-7.4.2.v20110526
copy \java\apache-commons-daemon\commons-daemon-1.0.5-bin-windows\prunmgr.exe .\JettyService.exe
copy \java\apache-commons-daemon\commons-daemon-1.0.5-bin-windows\amd64\prunsrv.exe .\bin\JettyService.exe

REM 8. Time to install the service
bin\JettyService //IS//JettyService --DisplayName="Jetty Service" --Install=C:\java\jetty\jetty-distribution-7.4.2.v20110526\bin\JettyService.exe --LogPath=C:\java\jetty\jetty-distribution-7.4.2.v20110526\logs --LogLevel=Debug --StdOutput=auto --StdError=auto --StartMode=Java --StopMode=Java --Jvm=auto ++JvmOptions=-Djetty.home=C:\java\jetty\jetty-distribution-7.4.2.v20110526 ++JvmOptions=-DSTOP.PORT=8087 ++JvmOptions=-DSTOP.KEY=downB0y ++JvmOptions=-Djetty.logs=C:\java\jetty\jetty-distribution-7.4.2.v20110526\logs ++JvmOptions=-Dorg.eclipse.jetty.util.log.SOURCE=true ++JvmOptions=-XX:MaxPermSize=128M ++JvmOptions=-XX:+CMSClassUnloadingEnabled ++JvmOptions=-XX:+CMSPermGenSweepingEnabled --Classpath=C:\java\jetty\jetty-distribution-7.4.2.v20110526\start.jar --StartClass=org.eclipse.jetty.start.Main ++StartParams=OPTIONS=All ++StartParams=C:\java\jetty\jetty-distribution-7.4.2.v20110526\etc\jetty.xml ++StartParams=C:\java\jetty\jetty-distribution-7.4.2.v20110526\etc\jetty-deploy.xml ++StartParams=C:\java\jetty\jetty-distribution-7.4.2.v20110526\etc\jetty-webapps.xml ++StartParams=C:\java\jetty\jetty-distribution-7.4.2.v20110526\etc\jetty-contexts.xml ++StartParams=C:\java\jetty\jetty-distribution-7.4.2.v20110526\etc\jetty-testrealm.xml --StopClass=org.eclipse.jetty.start.Main ++StopParams=--stop

REM 9. Test that the service starts at the command prompt
bin\JettyService //TS

REM 10. To delete the service uncomment the line below
REM bin\JettyService //DS

REM 11. Now launch the GUI manager to check the parameter settings
JettyService.exe

REM You can use the GUI to start and stop the service, and to change the settings
REM If you want the GUI exe to have a different name to the service exe,
REM   then close the GUI and uncomment and run the line below
REM ren JettyService.exe JettyServiceMgr.exe
REM To launch the renamed GUI uncomment and run the line below
REM JettyServiceMgr.exe //ES//JettyService  


完成!


done!

这篇关于将Jetty 7作为Windows服务运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆