PDA

View Full Version : Can't launch glassfish server at boot




Leslie.Hon
Jun 20, 2012, 04:23 AM
Hi, I setup a Lion Server and install Glassfish 3.1.2 using Homebrew
Now I can start the service by manual
asadmin start-domain domain1

Now I want to start the glassfish at server boot (without login)
I tried to follow
HERE (http://lowbittest.wordpress.com/2007/11/06/running-glassfish-on-mac-os-x-using-launchd/.) to setup a launchd

Here is my script (modified the path for homebrew)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sun.glassfish</string>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>appserver</string>
<key>GroupName</key>
<string>appserverusr</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/asadmin</string>
<string>start-domain</string>
<string>domain1</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

When I reboot the server, it can't start the service , the log is shown below:

Jun 20 17:06:54 server com.apple.launchd[1] (com.sun.glassfish[2439]): Suspicious setup: User "appserver" maps to user: _appserver
Jun 20 17:06:55 server com.apple.launchd[1] (com.sun.glassfish[2439]): Tried to setup shared memory more than once
Jun 20 17:06:56 server com.sun.glassfish[2439]: The main GlassFish configuration file is missing. This is where it is supposed to be: /usr/local/Cellar/glassfish/3.1.2/libexec/glassfish/domains/domain1/config/domain.xml
Jun 20 17:06:56 server com.sun.glassfish[2439]: Command start-domain failed.
Jun 20 17:06:56 server com.apple.launchd[1] (com.sun.glassfish[2439]): Exited with code: 1
Jun 20 17:07:05 server sandboxd[2319] ([73]): mds(73) deny file-write-data /dev/dtracehelper

:confused:



adam-dennis
Jul 23, 2012, 04:20 AM
Hi Leslie,

Did you find a solution?

thanks in advance,
Adam.

wrldwzrd89
Jul 23, 2012, 06:16 AM
The first thing to check when diagnosing issues like this one is the working directory. Remember that when launchd starts something, its working directory will NOT be the same as the one used when you start things manually from the Terminal. This is especially troublesome if relative paths are used, as these break if the working directory isn't set to what is expected.