launching resin on mac xserve

Bernard Bernstein <[email protected]> Thu, 15 Jun 2006 09:26:17 -0400
Newsgroups gmane.text.xml.resin.user
Message-ID <[email protected]>
We have had problems running resin headless on an xserve using JAI  
for image rendering. The recent thread on image rendering reminded me  
of it and I wanted to share our solution so that others on this  
platform can benefit from our experience.

Apparently it doesn't matter if you're using java 1.4 or 1.5, the mac  
xserve has some trouble with name spaces when there is a service  
running. We've found that the app may run for a while without any  
problems, but at some unknown point, it will crash in a bad way when  
some os calls are made.

Here's a blog that I found that explained it along with the solution:

http://www.detailedbalance.net/glove-compartment/2006/04/18/os-x- 
java-15-javaawtheadless-and-death


Since we use resin on sparcs as well as xserves, we needed to make  
the solution simple enough that the same launcher can continue to  
work on both platforms. Here's the simple fix:

In httpd.sh or whatever script you use to launch wrapper.pl, or in  
any wrapper you might have, you need to execute it inside /usr/ 
libexec/StartupItemContext

I simply added a check that that file exists to see if the platform  
supports it, and then startup the instance accordingly.

This might be something useful to add to the standard launcher, so  
Scott may want to take note.


ctl_command=exec $perl $bin/wrapper.pl -chdir -name "$name" -class  
"$class" $args $*
if [ -f "/usr/libexec/StartupItemContext" ]; then
     exec sudo /usr/libexec/StartupItemContext $ctl_command
else
     $ctl_command
fi


I wanted to get this on the record to hopefully save others the days  
we've spent trying to work this out.

The bottom line. if you're running any server application (any app,  
not just resin) on xserve, you probably need to wrap it in  
StartupItemContext.



Bernie