Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Leslie.Hon

macrumors member
Original poster
Apr 27, 2008
32
0
Hi, I setup a Lion Server and install Glassfish 3.1.2 using Homebrew
Now I can start the service by manual
Code:
asadmin start-domain domain1

Now I want to start the glassfish at server boot (without login)
I tried to follow
HERE to setup a launchd

Here is my script (modified the path for homebrew)

Code:
<?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:

Code:
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:
 

wrldwzrd89

macrumors G5
Jun 6, 2003
12,110
77
Solon, OH
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.