This will set up JBoss to run as a service daemon on a Mac OS X (tested on 10.5) using launchd. It allows JBoss to be run automatically in the background without users logged in.
- Create a jboss.plist file (this is an XML file). I've uploaded an example that just needs a few changes.
- Change the field under UserName from jboss to whatever your username is.
- Change the field under GroupName from staff to whatever you group name is.
- Change the field under ProgramArguments from /Users/jboss/Desktop/4.2.0_CP04/jboss-as/bin/run.sh to whatever the path to your jboss 'run.sh' file is.
- If you are not using the production configuration, replace the line that says production with your server configuration.
- You now have a description of a OS X service. You just need to register it with OS X. On the command line, type the following:
launchctl load <path-to-file>/jboss.plist
JBoss should launch and remain launched when you log out. You may want to include additional flags like the binding address. Add this just like the server configuration command line arguments.
You will probably want to use the actual IP of the NIC of that machine as the binding address instead of 0.0.0.0.
Once you have registered the server with the launchctl load command, you can start and stop the server with the following commands. Note that on some systems the launchctl stop command will not kill the JBoss process and you will have to use the admin console to stop the process or kill the process from the command line.
launchctl start jboss_server_4_2_0
launchctl stop jboss_server_4_2_0
Icon still appears in my dock bar
This can happen when your application contains some references to AWT or other GUI related code that OS X detects as being displayable. To resolve this, add the following flag to your plist file from above.
If you want to have JBoss always start like this (with and without launchctl) then put this line at the end of your run.conf file in your JBoss bin directory.