Bug 732889
Summary: | Instructions for installing JBoss as Windows service do not work | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | James Livingston <jlivings> | ||||||
Component: | Scripts and Commands | Assignee: | Tom Fonteyne <tfonteyn> | ||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | |||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 6.1.1 | CC: | akeeb.yaragatti, jawilson, joallen, jshepherd, jskeoch, jstefl, misty, msadhukh, myarboro, pkremens, rdickens, sicherweise, tfonteyn, vtunka | ||||||
Target Milestone: | --- | Keywords: | Documentation, Reopened | ||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | Topic ID:3757 Build: 20110822-1045 | ||||||||
Fixed In Version: | Doc Type: | Enhancement | |||||||
Doc Text: |
The `service.bat` batch file for managing JBoss EAP installed as a service on Microsoft Windows Server has been upgraded, with improved error checking. The added checks are aimed at testing for conditions which would prevent the service running as expected.
|
Story Points: | --- | ||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2013-09-19 10:58:59 UTC | Type: | Enhancement | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
On hold until the Enterprise components are available. Changing to new default queue. Sent this email to EAP PM List: Hi, We currently point customers to http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-9.html for the JBoss Natives packages which will let them install EAP as a service on Windows. Where will these packages be located and what will they be called, for GA? We really need to make sure we have all of the appropriate links in place. Thanks, Misty There are bits in http://download.devel.redhat.com/devel/candidates/JBEAP/JBEAP-6.0.0-CR1/native/ in the jboss-eap-native-utils zips, which I *think* is for service installation. A customer just reported that the instructions given do not work with EAP 6 since there is no shutdown.bat Substantial changes to this topic have been made. Needs new QE. It's a bit risky because things can change. We can see what we can do about it for 6.0.1. You can point to specific downloads, but that isn't what you'll want to do since they are version-specific. You would have to change the URL in the docs every release to point to the current version, and that will almost certainly confuse everyone who wants them for a previous release. What we want to execute is this: taskkill.exe /F /FI "SERVICES eq JBossEAP6" /t We could use the following, except that quote escpating doesn't work quite like this in Windows and I can't figure it out: --StopImage=taskkill.exe ++StopParams="/F /FI \"SERVICES eq JBossEAP6\" /t" So use: --StopMode=exe --StopImage=cmd.exe --StopPath=%JBOSS_HOME/bin ++StopParams="shutdown-pid.bat" where shutdown-pid.bat contains: @echo off setLocal EnableDelayedExpansion set /p PID=<=%JBOSS_HOME%\standalone\log\jboss-service.pid taskkill.exe /PID %PID% Both of these will obviously need testing This works, but causes an error to appear since prunsrv.exe gets killed: --StopImage=taskkill.exe ++StopParams=/F ++StopParams=/FI ++StopParams="SERVICES eq JBossEAP6" Madhumita Sadhukhan <msadhukh> made a comment on jira JBPAPP-9508 Hi James, So should I assign this to you?I believe the scripts need to be fixed. I think I have the full solution: 1. Make sure to set JBOSS_HOME as a system environment variable pointing to the JBoss installation directory 2. Add a system environment variable NOPAUSE=1 Alternatively edit the last line of both standalone.bat (domain.bat) / jboss-cli.bat and remove this line: if "x%NOPAUSE%" == "x" pause 3.Open a cmd.exe window 4. execute a "set JBOSS_HOME=..." (not needed if you open the cmd.exe *after* you have added the system env. var) 5. Installing the service, enter the below on one line: prunsrv //IS//JBossEAP6 --DisplayName="JBoss Enterprise Application Platform 6" --LogLevel=DEBUG --LogPath=%JBOSS_HOME%\standalone\log\ --LogPrefix=service --StdOutput=auto --StdError=auto --StartMode=exe --StartImage=cmd.exe --StartPath=%JBOSS_HOME%/bin ++StartParams="/c standalone.bat" --StopMode=exe --StopImage=cmd.exe --StopPath=%JBOSS_HOME%/bin ++StopParams="/c jboss-cli.bat --connect command=:shutdown" Adjust loglevel as required of course (f.e. just INFO) or use "domain" instead of "standalone" for executable and path as needed. 6. You should now have a service installed that you can manually start/stop from the Services window. Set to automatic is so required. Should you need to remove the service, use this: prunsrv //DS//JBossEAP6 it is probably the cleanest if the above gets combined in a "service.bat" that takes commands line "install,start,stop,restart" just like JBoss 5 provided. Let me know, and I can knock on up. Yeah, that would work. I probably avoided that because you couldn't do it in EAP 4/5 without including the credential details - EAP 6 you can because of local authentication. In replacement of my comment #15, covering domain mode + a little cleanup, the following can be added the documentation: ===================================================================== 1. Add a system environment variable NOPAUSE=1 Alternatively edit the last line of both standalone.bat (domain.bat) / jboss-cli.bat and remove this line: if "x%NOPAUSE%" == "x" pause 2. Open a cmd.exe window 3. execute a "set JBOSS_HOME=..." or use the full path in the below statement 4. Installing the service, enter one of the below on one line: For standalone: prunsrv //IS//JBossEAP6 --DisplayName="JBoss Enterprise Application Platform 6" --LogLevel=INFO --LogPath=%JBOSS_HOME%\standalone\log\ --LogPrefix=service --StdOutput=auto --StdError=auto --StartMode=exe --StartImage=cmd.exe --StartPath=%JBOSS_HOME%/bin ++StartParams="/c standalone.bat" --StopMode=exe --StopImage=cmd.exe --StopPath=%JBOSS_HOME%/bin ++StopParams="/c jboss-cli.bat --connect command=:shutdown" For domain mode: prunsrv //IS//JBossEAP6 --DisplayName="JBoss Enterprise Application Platform 6" --LogLevel=INFO --LogPath=%JBOSS_HOME%\domain\log\ --LogPrefix=service --StdOutput=auto --StdError=auto --StartMode=exe --StartImage=cmd.exe --StartPath=%JBOSS_HOME%/bin ++StartParams="/c domain.bat" --StopMode=exe --StopImage=cmd.exe --StopPath=%JBOSS_HOME%/bin ++StopParams="/c jboss-cli.bat --connect command=/host=master:shutdown" Note the difference in shutdown command. If not using the default "master", make sure to add the right host name or alias you used for the domain controller Adjust loglevel as required of course. 5. You should now have a service installed that you can manually start/stop from the Services window. Set to automatic if so required. Should you need to remove the service, use this: prunsrv //DS//JBossEAP6 ===================================================================== Tom Fonteyne <tfonteyn> made a comment on jira JBPAPP-9508 I created the attached service.bat for EAP 6.0 usage. Copy it to the modules\native\sbin directory It's a first attempt but does the job Usage: service.bat install => installs standalone.sh service.bat install domain => installs domain.sh Other options: service.bat uninstall service.bat start service.bat stop service.bat restart You can edit the section at the top to change log level or service name. For domain mode, it uses "master" for the domain controller. Change when needed todo: - nicer user messages like for example change the printing of the errorlevel - have options for DC and loglevel Tom Fonteyne <tfonteyn> updated the status of jira JBPAPP-9508 to Coding In Progress Nuno Ferreira <nuno.ferreira> made a comment on jira JBPAPP-9508 Hi, Using Tom´s script and the problem is that the domain controller don´t stop, or better, it stops, but the windows service remains in stopping state forever until the machine restarts. anyone have this behavior? Using windows 2008 r2 server. cheers Jacek Palka <jacek.palka> made a comment on jira JBPAPP-9508 Hi, I've tried to use the suggested work around, but the service has not been possible to stop - the Java processes went down, but the prunsrv.exe process was still running making the service to be marked as "Stopping" in the Server Manager. First after I've killed the process in the Task Manager the service has been stopped. I was testing on Windows 2008 R2. Nuno Ferreira <nuno.ferreira> made a comment on jira JBPAPP-9508 I´ve come up with the solution. I´ve to remove all the section of the domain.bat (i believe its the same as standalone.bat): ":END if "x%NOPAUSE%" == "x" pause :END_NO_PAUSE" After doing this the windows service works well. cheers. yes, that bit is missing from the service script which is not finalized yet. I'll work that in later Tom Fonteyne <tfonteyn> made a comment on jira JBPAPP-9508 I added the NOPAUSE support into the script. There is now no need any more to set environment variables or modify the standalone/domain.bat files. service_v2.bat 06/Sep/12 Rename it to "service.bat" and copy it to the modules\native\sbin directory Usage: service.bat install => installs standalone.sh service.bat install domain => installs domain.sh Other options: service.bat uninstall service.bat start service.bat stop service.bat restart You can edit the section at the top to change log level or service name. For domain mode, it uses "master" for the domain controller. Change when needed. todo: - nicer user messages like for example change the printing of the errorlevel - have options for DC and loglevel Tom Fonteyne <tfonteyn> made a comment on jira JBPAPP-9508 service_v3.bat 14/Sep/12 - fixed the location for the service logfile - added command line options for all settings, no need to edit the script any longer => this means a change in the syntax for installing in domain mode ! - better help Install: Download service_v3.bat, rename it to "service.bat" and copy it to the modules\native\sbin directory Run the batch file without arguments to get usage information. still todo: nicer user messages like for example change the printing of the errorlevel George Rypysc <georgethree> made a comment on jira JBPAPP-9508 Properly handles spaces in LogPath, StartPath, and StopPath George Rypysc <georgethree> made a comment on jira JBPAPP-9508 service_v4.bat - Small changes to properly handles spaces in LogPath, StartPath, and StopPath and fix "Succes" typo. *** Bug 834255 has been marked as a duplicate of this bug. *** This procedure remains broken due to the underlying issues documented in the various tracking bugs. I am removing the topic, and closing this as INSUFFICIENT_DATA until the underlying issues are resolved. re-opening, needs modifications for EAP 6.1 Created attachment 759237 [details]
service.bat version5 fixed for 6.1
New version 5, now working with both EAP 6.0.x and 6.1
@TomF: Given that this will have to have updated docs, this probably better belongs in 6.2 than 6.1.1. Let's talk further if you disagree. @Jimmy: fair enough. The script could do with a little better error reporting anyhow. I'll make sure to do this in time for 6.2.0 Meanwhile several customers use the script already and are happy with it. This is duplicated by bug 960560, where they have a completely different service script with less features, which is apparently going to be included in 6.1.1 :( Created attachment 788918 [details]
service.bat version6
I finished v6 of the script. I added quite a bit of extra defence against misuse and new options to set the service-user, service-name... and more.
I did do several tests, but I did not test to destruction.
So, anyone who wants to play/test is welcome.
*any* feedback is welcome, specially bad feedback as that would allow me to get it better
Unzip the attachment, and copy the file to one of these locations:
6.0.x: %JBOSS_HOME%\modules\native\sbin\
6.1.x: %JBOSS_HOME%\modules\system\layers\base\native\sbin\
or, as an alternative to %JBOSS_HOME%\bin
just execute the script to get the usage screen, and take it from there.
Wow Tom, hot stuff this. Was just grumbling how v5 didn't work just a couple of hours ago. I can confirm v6 works with vanilla 6.1 EAP in my environment. Except when I enable SSL for management interface - 'service_v6.bat stop /controller xxx.xxx.xxx.xxx:9999' will fail with : ERROR: Failed to load service configuration. The certificate had been saved permanently. Stopping in services.msc will result in all-too-well-known 'stopping' state. My known workaround is to shutdown the service via jboss-cli.bat instead. Is this a known limitation or am I doing something wrong? Running on Windows Server 2008 R2 SP1. @TSMY_MWSE : thanks :) I did not actually test it yesterday, but have just tested it and it's not a bug. If you configure the management interface to use certificates, then you really should configure %JBOSS_HOME%\bin\jboss-cli.xml as well. What you are seeing is an unconfigured cli, which as a result goes in interactive mode and fails. I've just tested with key+trusts store with mutual trust: - management interface: keystore: the server cert/key truststore: the client cert - jboss-cli.xml: keystore: the client cert/key truststore: the server cert and the service cleanly shuts down. Here are some details: I use named paths: <paths> <path name="keystore.home" path="c:\etc\"/> <path name="truststore.home" path="c:\etc\"/> </paths> management: <security-realm name="CertificateRealm"> <server-identities> <ssl> <keystore path="kdc2008.jbossuk.com.keystore.jks" relative-to="keystore.home" keystore-password="secret" alias="kdc2008.jbossuk.com"/> </ssl> </server-identities> <authentication> <truststore path="kdc2008.jbossuk.com.truststore.jks" relative-to="truststore.home" keystore-password="secret"/> </authentication> </security-realm> jboss-cli.xml: <ssl> <alias>cliclient</alias> <key-store>c:\etc\cliclient.keystore.jks</key-store> <key-store-password>secret</key-store-password> <trust-store>c:\etc\cliclient.truststore.jks</trust-store> <trust-store-password>secret</trust-store-password> <modify-trust-store>true</modify-trust-store> </ssl> It seems this BZ was accidentally reopened after it was properly closed. Everything is tracked in BZ1006346. This is now part of EAP 6.2.0 ER2. Release notes entry added for publication in the JBoss EAP 6.2.0 Release Notes document. Hi Team, I am new to Jboss and I am trying to setup Jbos EAP 6.3 and want to start and stop this server using batch script.Currently I am stopping the server using ctrl+c , I am trying difficult to find command to replace ctrl+c.I found alternative solution as setting jboss as service on windows then run star and stop commands. But , I am unable to set jboss as windows service. Please help. Let me know what details are required from my end. I will appreciate quick response. Thanks and Regards, Akeeb.K.Y @Akeeb: Note that this is not a support forum, but a bug reporting site. Please visit http://www.jboss.org/forums/ and log your request for help there. Should you be a Red Hat customer, then open a support case on the Red Hat customer portal. Kind regards Tom Thank You Tom for link. |
> 32-bit, 64-bit, and Itanium 64-bit packages are available from http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-9.html. This is probably okay for now, but this bug can be a reminder that it needs to be changed to not point to community bits before actual releases.