Did Jetty 7 drop support to run as a service using Java Service Wrapper? What options do I have now?
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
In the latest stable version of Java Service Wrapper (JSW 3.4.1) there's WrapperJarApp method of integration:
This is part of my configuration:
@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.
For more info see
done!
If you are in a bit of a locked down environment and need to stay within the Microsoft provided tool set, then
srvany
,instsrv
andsc
are your friends. Unfortunately it often includes making registry edits. The nice thing is it's very flexible.Here's what I did recently to auto-start a Selenium Grid hub server.
Copy
srvany.exe
intoc:\tools\srvany\srvany.exe
Open cmd window as admin and run:
RegEdit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Selenium Grid Hub Server
Add a new key named
Parameters
Under that key, add 3 new String Values named:Application
=>${JAVA_HOME}/bin/java.exe
AppParameters
=>-jar selenium-server-standalone-2.42.2.jar -role hub
AppDirectory
=>C:\tools\selenium
Credit for this goes to http://codeforjava.blogspot.com/2010/12/run-java-application-as-windows-nt.html
You can run as a Windows service Jetty can be used to exewrap.
Jetty Windows Service all-in-one packages are also distributed.
http://exewrap.sourceforge.jp/jetty/
Take a look at Procrun from the Apache Commons. You'll want to browse the native binaries download area to get the Windows binaries.
You can get the src from: http://svn.codehaus.org/jetty/jetty/branches/jetty-7/jetty-win32/ and build it yourself.
But I manually installed the wrapper as any “standard” wrapper installation.
Took the original Jetty-Service.conf file and changed:
wrapper.java.mainclass=org.mortbay.jetty.win32service.JettyServiceWrapperListener to wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
And added…
wrapper.app.parameter.1=org.eclipse.jetty.start.Main <-- Main class wrapper.app.parameter.2=../etc/jetty.xml wrapper.app.parameter.x=../etc/jetty-x.xml <--Any additional config files you wish to include… wrapper.app.parameter.y=../etc/jetty-y.xml
Seems to start fine and it seems to shutdown gracefully too.