Did Jetty 7 a-t-il abandonné le support pour s'exécuter en tant que service à l'aide de Java Service Wrapper? Quelles options ai-je maintenant?Exécution de Jetty 7 en tant que service Windows
Répondre
@glb, merci d'avoir signalé apache commons-daemon Procrun.
Cela fonctionne très bien pour moi sur Windows 7 64 bits, voici comment je l'ai mis en place.
Pour plus d'informations voir
- procrun page par lien de @glb écran
- jetée aide> 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
fait!
Dans la dernière version stable de Java Service Wrapper (JSW 3.4.1), il y a la méthode WrapperJarApp d'intégration:
Cela fait partie de ma configuration:
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp
wrapper.java.classpath.1=%WRAPPER_HOME%/lib/*.jar
wrapper.java.classpath.2=%JETTY_HOME%/lib/*.jar
wrapper.java.classpath.3=%JETTY_HOME%/start.jar
wrapper.java.library.path.1=%WRAPPER_HOME%/lib
wrapper.app.parameter.1=%JETTY_HOME%/start.jar
wrapper.app.parameter.2=%JETTY_HOME%/etc/jetty.xml
# other config params as needed
Dans mes tests initiaux avec ceci, Jetty semble fonctionner mieux si JSW est lancé à partir de '% JETTY_HOME%' (c.-à-d. déposez les configs JSW, jar et DLL dans le répertoire d'installation de Jetty). De cette façon, si Jetty cherche les paramètres de configuration par rapport au chemin actuel, le service s'exécute à partir de l'emplacement attendu. – mckamey
Jetez un oeil à Procrun des Apache Commons . Vous aurez envie de parcourir la zone de téléchargement des binaires natifs pour obtenir les binaires Windows.
Vous pouvez obtenir le src de: http://svn.codehaus.org/jetty/jetty/branches/jetty-7/jetty-win32/ et le construire vous-même. Mais j'ai installé manuellement le wrapper comme une installation d'emballage "standard".
A pris le fichier Jetty-Service.conf original et changé:
wrapper.java.mainclass = org.mortbay.jetty.win32service.JettyServiceWrapperListener à wrapper.java.mainclass = org.tanukisoftware.wrapper. WrapperSimpleApp
Et ajouté ...
wrapper.app.parameter.1 = org.eclipse.jetty.start.Main < - classe principale wrapper.app.parameter.2 = ../etc/jetée. xml wrapper.app.parameter.x = ../etc /jetty-x.xml < fichiers de configuration supplémentaires --Any que vous souhaitez inclure ... wrapper.app.parameter.y = ../etc/jetée-y.xml
semble commencer fin et il semble à l'arrêt avec élégance aussi.
J'ai rencontré un problème lors de l'exécution du code de @ crowne pour installer le service (j'utilise Jetty 8.1.0). Juste besoin de changer -StartMode=Java --StopMode=Java
à -StartMode=jvm --StopMode=jvm
et supprimer ++JvmOptions=-XX:+CMSPermGenSweepingEnabled
.
Après que je créé un create_jetty_service.bat à la jetée/bin et exécutez le fichier à partir de là:
set jetty_home = C:\java\jetty\jetty-hightide-8.1.0.v20120127
JettyService //IS//JettyService --DisplayName="Jetty Service"^
--Install=%jetty_home%\bin\JettyService.exe^
--LogPath=%jetty_home%\logs^
--LogLevel=Debug --StdOutput=auto --StdError=auto --StartMode=jvm --StopMode=jvm --Jvm=auto^
++JvmOptions=-Djetty.home=%jetty_home%^
++JvmOptions=-DSTOP.PORT=8087^
++JvmOptions=-DSTOP.KEY=downB0y^
++JvmOptions=-Djetty.logs=%jetty_home%\logs^
++JvmOptions=-Dorg.eclipse.jetty.util.log.SOURCE=true^
++JvmOptions=-XX:MaxPermSize=256M^
++JvmOptions=-XX:+CMSClassUnloadingEnabled^
--Classpath=%jetty_home%\start.jar^
--StartClass=org.eclipse.jetty.start.Main^
++StartParams=OPTIONS=All^
++StartParams=%jetty_home%\etc\jetty.xml^
++StartParams=%jetty_home%\etc\jetty-deploy.xml^
++StartParams=%jetty_home%\etc\jetty-webapps.xml^
++StartParams=%jetty_home%\etc\jetty-contexts.xml^
++StartParams=%jetty_home%\etc\jetty-testrealm.xml^
--StopClass=org.eclipse.jetty.start.Main ++StopParams=--stop
exécuter cmd.exe Rappelez-vous en tant qu'administrateur à la commande prenne effet.
Vous pouvez exécuter en tant que service Windows Jetty peut être utilisé pour exewrap.
Les packages tout-en-un Windows Service Jetty sont également distribués.
Si vous êtes un peu d'un environnement verrouillé et besoin de rester dans le Microsoft a fourni un ensemble d'outils, puis srvany
, instsrv
et sc
sont vos amis. Malheureusement, cela implique souvent d'apporter des modifications au registre. La bonne chose est que c'est très flexible.
Voici ce que j'ai fait récemment pour démarrer automatiquement un serveur concentrateur Selenium Grid.
Copie srvany.exe
dans c:\tools\srvany\srvany.exe
Ouvrir la fenêtre cmd en tant qu'administrateur et exécutez:
$ cd C:\tools\srvany
$ sc create "Selenium Grid Hub Server" binPath= c:\tools\srvany\srvany.exe DisplayName= "Selenium Grid Hub Server"
Regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Selenium Grid Hub Server
A dd une nouvelle clé nommée Parameters
Sous cette clé, ajouter 3 nouvelles valeurs de chaîne nommée:
Application
=>${JAVA_HOME}/bin/java.exe
AppParameters
=>-jar selenium-server-standalone-2.42.2.jar -role hub
AppDirectory
=>C:\tools\selenium
Crédit pour ceci va à http://codeforjava.blogspot.com/2010/12/run-java-application-as-windows-nt.html
- 1. Service WCF en tant que service Windows (0) Windows 7
- 2. Exécution de Django en tant que service Windows
- 3. Exécution de l'application en tant que service Windows
- 4. Exécution de mongod en tant que service Windows
- 5. Exécution de la servlet Tomcat en tant que service Windows
- 6. Exécution d'une application WPF en tant que service Windows
- 7. Exécution d'un script batch en tant que service Windows
- 8. exécution de plusieurs instances de mongod en tant que service
- 9. Exécuter l'application Windows en tant que service?
- 10. Programme Java en tant que service Windows
- 11. Exécution des applications Rails avec thin en tant que service
- 12. Windows 7 en cours d'exécution en tant que serveur
- 13. Exécution d'un serveur Web Python en tant que service sous Windows
- 14. Windows 7: Enregistrement en tant que groupe TIFF CCITT4 modifié?
- 15. Comment installer Apache FtpServer en tant que service sous Windows 7 (64 bits)?
- 16. Plusieurs instances de même application en tant que service Windows?
- 17. Hôte WCF en tant que pannes de service Windows
- 18. Tomcat Journalisation en cours d'exécution en tant que service Windows
- 19. Exécution des services en tant que processus différents
- 20. CruiseControl.NET s'exécute en tant que service Windows et en tant que processus autonome se comporte différemment
- 21. Service Windows 7 Undead
- 22. .net Windows service en tant que serveur d'état
- 23. Windows Mobile - Programme Compact Framework en tant que service?
- 24. Exécuter IKVM exe en tant que service Windows
- 25. Installer EXE en tant que service sur Windows 2008 Server
- 26. Exécution d'un service Windows dans une console
- 27. Injection de dépendances: Jetty 7
- 28. Résilience pour le service WCF hébergé en tant que service Windows
- 29. Exécution du projet aC# sous Windows 7
- 30. Filetage en tant que service WCF
Merci pour l'info. Juste pour vous le faire savoir: pour que cela fonctionne correctement, j'ai dû définir la variable d'environnement JAVA_HOME. –
L'interface utilisateur est particulièrement utile pour vérifier que le runtime Java est utilisé. Et assurez-vous que JAVA_HOME est défini dans les variables d'environnement * System *, pas celles de l'utilisateur. Sinon, tout cela fonctionne pour vous, mais pas pour le service. –