What you need to know to run a JBoss server instance as a Windows Service.
Until recently it was done by using JavaService.exe or tanuki wrapper. Both involved quite a bit of configurations compared to what's available directly from JBoss.
Please note that this features is available in JBoss 5 by default. No need to download the files from jboss-native.
This solution will work with JBoss 4 too. I have tested it on JBoss 4.0.3, JBoss 4.2.3 and JBoss 5.0.0.
Some information is available at http://jboss.org/community/docs/DOC-10679
Download the distribution from http://www.jboss.org/jbossweb/downloads/jboss-native/
You will find links for different windows versions, select the appropriate one.
The downloaded file will be in .zip format, unzip it somewhere.
Copy jbosssvc.exe, service.bat and README-service.txt to your JBOSS_HOME/bin folder.
The file README-service.txt contains instructions on configurations changes.
Unfortunately the above file doesn't explain the part about service name related configuration
By default the service.bat contains settings entered for JBoss 5.
set SVCNAME=JBAS50SVC
set SVCDISP=JBoss Application Server 5.0
set SVCDESC=JBoss Application Server 5.0.0 GA/Platform: Windows x86
You may want to change it you describe your environment. If you are running multiple JBoss instances in machine, make sure you are using different values for SVNNAME in each instance.
Let's say you are using it with JBoss 4.0.3:
set SVCNAME=JBAS403SVC
set SVCDISP=JBoss Application Server 4.0.3
set SVCDESC=JBoss Application Server 4.0.3 GA/Platform: Windows x86
Next part to look at is where run.bat and shutdown.bat is referred. You may want to modify there if you want to pass arguments these batch files.
e.g.
jbosssvc.exe -p 1 "Starting %SVCDISP%" > run.log
call run.bat -c all -b 127.0.0.1 < .r.lock >> run.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log
run.log file is where console output is written to.
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown.log
call shutdown -S --server=myserver:2099 < .s.lock >> shutdown.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown.log
shutdown.log contains console outputs after service is stopped
To create/register the JBoss service with the windows service manager (This needs to be done only once)
JBOSS_HOME/bin> service.bat install.
Now the service will be available in the windows services manager. It can be modified and operated just like any other service.
If you ever want to remove the JBoss service from Windows, use the following command:
JBOSS_HOME/bin> service.bat uninstall.
That's all....
BTW, why JBoss is run as a Windows Service?
- Automatically starts the process on system startup, and closes it on shutdown (when automatic)
- It launches the application as Windows service at system boot, before user logon and runs it without the need of a user session.
- Standard windows service monitoring mechanism can be utilized to check the application availability
- The application can be started using 'service account' without having to login as that user.
44 comments:
Hi,
Just wanted to know if you any idea on how to make this run.log file a role over append log file.
thanks,
Adnan
As run.log file is created to redirect the output to console, there is no direct support from JBoss for file rotation. You have to run some cron job to do this.
But ideally your run.log file shouldn't contain JBoss server logging output in it. The server log output will gets written in the server.log (or whatever the name u've given) file of JBoss, right?
Just comment appender-ref ref="CONSOLE" in the log4j file. So run.log file will not contain same output as in server.log file hence will be smaller in size and the file rotation/roll over is not necessary
is there a way to run multiple instances of jboss service ??/
consider i have two configurations under the server folder..can i start two services each pointing to the configuration using -c command ???
or do i need to have two separate jboss server ??
Yes, you can.
either
create a separate service.bat file for each jboss instance and add the -c switch next to the call run ...
call run.bat -c node1 -b 127.0.0.1 < .r.lock >> run.log 2>&1
Or
you can pass the configuration name as a switch to service.bat and use the variable against the -c switch
call run.bat -c $1 -b 127.0.0.1 < .r.lock >> run.log 2>&1
For running multiple instance I tried to create another copy of service.bat and entered the parameters in the call routine and successfully installed the service. But when I try to ctart the service I get a WIndows Service error --> "Some services stop automatically if they have no work to do, for example the Performance Log"
I tried to create another .log and .lock files and it did not help. Advise please...
To add to my earlier blog --> Althoug the service does not start when I try service2.bat start the server starts successfully(using run2.lo and .r2.lock). Any idea why it fails from Windows service?
I was using the wrong bat file. My problem.
Glad to know that you were able to make it work
hello,
I have an issue, where in i am able to run the JBoss as windows service in XP.
I am using two approach :
1) Approach 1: Using JBoss native connector:
Issue with this service: Not able to start the service. Getting an error message “service started and stopped”. Tried setting with account also but it didn’t work.
2) Approach 2: Adding a batch script in registry of windows service to start JBoss:
Issue with this service: we are able to start and stop this service but when we logoff Jboss running as service gets stopped.
Appriciate your valuable inputs.
I have the similar problem as promod said when I am trying to run two instances. I have created a copy of service.bat and renamed it as service2.bat.
Done the below changes to service2.bat
1. Updated the bat file name as serrvice2.bat in :cmdInstall section
2. Changed the changed the run.log to run2.log in all the places.
3.Changed shutdown.log to shutdown2.log.
4. Updated :cmdStart section as below:
call run.bat -c instance2 -b hostname < .r.lock >> run2.log 2>&1
Did I miss anything here?
When I tried to start service2 i am getting the WIndows Service error --> "Some services stop automatically if they have no work to do, for example the Performance Log"
Any advice please...
Thanks
Sunil
Problem got fixed. Changed r.lock to r2.lock and s.lock to s2.loack in all the palces of service2.bat. Now two jobss services are running without any problem.
Thanks
I was about to look into this. You beat me :)
hi,
I have the same problem as ajay.
after an access using the /console parameter via rdp, when we log off from the system the service is stopped.
any ideas?
Hi, I am using JBoss 5.1 as windows service. I am installing it by using IZ pack. After installation, service get started with service type as manual. I want to make it as AUTOMATIC. So after machine restart I should able to see service has been started, no need to go in services.msc and start the service each time. Please let me know how to do this?
Hi Nish,
I also tried to find how to make JBOSS service as automatic.
There is an alternative approach,any how you are using IZpack.better create an batch file and and make jboss service as automatic.This how i made JBOSS service as automatic.
Thanks
Ravi S
Hi,
is there a way to specify the "log on as" user and the password from the service.bat file itself? so that when installing the service you won't have to manually change from "local system account"?
Nice one,
I never found in the JBOSS documents that you should copy the files(jbosssvc.exe and service.bat) to the bin directory.
You helped me a lot with this.
Cheers
Dave
You hit comprehend out of the most construction topics.
iphone 4 parts
Your blogs and information attracts me to come back again n again.
bad credit short term loans
I really enjoy while I read your blogs and articles.second dui penalties
I am not in favor of this new exam pattern.Its totally an injustice to the regional board aspirants.Its a well known fact that CBSE's marking system is comparatively easier than other regional boards.So,definitely CBSE candidates will score more in ISEET
tachnologys basket
Thank you for your post.
I am trying to install jboss 4.2.3, and I followed the instructions.
I have stopped jboss.
I got this error: "faild installing JBASXXX", this mean errolevel 2.
Any ideas?
Thanks in advance.
The stuff you are penning blows out my mind.flashback counter
Your write-ups are far more than wow!best graphics card for gaming
It’s really very informative that I wanted ever, thanks for this.
open multiple url
Well, They are offering good services for work and I really enjoyed the information you have shared. Download free software
Can you please provide the complete the details what services you are proving for windows.
I read these one that you have posted here but I would like to know about the complete.
Regards,
Alvin
DDL FOR ALL
Nice review about JBoss with shares many interesting conceptual information about the blog. I really enjoyed it.
Fully Software Plus
some of my concept are still not clear I will mail to know some more things about it. free software
I consider the use of this software that how it works and its benefits. Thank you so much for sharing this article. free software
Well Done Admin ...... you have done Nice Work ....
Portable Software | Free Download
you might explain in deep.....
Full Softwares | Free Full Version Software
valuable post! thankful for interesting and useful sharing.
Full Crack Software | Latest Software Download
helpful sharing! thanks to share...
Crack Software | Software Download Free
Very useful...!!! thanksss for sharing it.
Software Crack | Free Download Software
Great post! This sites is really helpful for us and I really appreciate it. I learned and many great ideas here. Thanks for sharing!
crack software | download free software
Prevented me from having to do this manually; thus, very useful, and much appreciated.
full version software | photo mechanic 5 crack
I appreciate thsi posting..its very helpful. Thanks!!!
cracked software download | 4k stogram license key
Helped alot..thanks for sharing!
pftrack crack
i am really much impressed to see this post it had many useful points and technologies
Quick Heal Total Security 2015 Product Key & Crack
I’ve to work with Servlets and JSP but having the problem in configuring JBOSS on windows xp platform. I’ve downloaded jboss-4.2.0.GA.zip, jboss_windows_service.zip... apache-ant-1.7.0-bin.zip & jboss-native-2.0.0-window...
Dissertation Help UK
Online diaries are web logs that are invigorated reliably, generally once per day. They contain information related to a specific point like Dissertation Point.Dissertation Services
The organization is exceedingly devoted to giving finely-composed and truly referenced theses at genuinely reasonable costs. Do My Dissertation
Aowsome, Helped alot..thanks for sharing it. license key for need for speed 2016
Post a Comment