|
From: Leif M. <le...@ta...> - 2006-02-11 01:47:40
|
Sean, > I've run into an odd situation and I was wondering if anybody had any > suggestions? > > I'm using Java Service Wrapper 3.1.2 on Mac OS X 10.4.4 (not OS X > Server) running Java 1.4.2_09. > > I've got an app wrapped using WrapperSimpleApp as per the Integration > Methods instructions Since I'm on a Mac the script and wrapper file > live in /Library/StartupItems/<appname>. With a bit of > wrapper.working.dir trickery I've got wrapper running my jar which > lives in /Library/MediaSpan/<appname>, which has uid:guid of > appserver:admin, as does my jar and its lib folder. > > My app subclasses java.rmi.server.UnicastRemoteObject to make it > configurable via RMI. It stores its configuration via > java.util.prefs.Preferences, using the node returned by > Preferences.userNodeForPackage(<myclass>.class). No call is ever made > to Preferences.systemNodeForPackage(). > > When I *do not* RUN_AS_USER, the WrapperSimpleApp wrapper starts my > app, and it runs just fine. I can connect via RMI and set my app's > configuration, which writes to the Preferences user node via the > putXXX and flush methods in Preferences. The Preferences calls all > work fine. Who are you when you are running in this case? root? > The trouble comes when I try to RUN_AS_USER=appserver. When I make > that one change everything works like before *except* the > Preferences.flush call, which throws a BackingStoreException: > > java.util.prefs.BackingStoreException: Synchronization failed for node > <myclass's user node> > > I'm confused as to why this is happening for the RUN_AS_USER case, but > not when wrapper runs my app as root... has anybody else had to deal > with this? > > I searched the java-dev mailing list at Apple but the only mention of > BackingStoreException puts the blame on making flush calls on a system > pref node returned by Preferences. systemNodeForPackage. Where are the preferences being stored? My guess is that it is attempting to write them to a location which the appserver user does not have write access. The RUN_AS_USER setting in the script is quite simple. It just uses su to launch the wrapper as the specified user. If that user does not have the required permissions to access all required resouces, you will run into problems. Since you are switching back and forth, make sure the wrapper.log and other files are all ok. If they are created with root, they may not be getting output when run as appserver. The wrapper is designed to fail silently if it can't write to the log file. Cheers, Leif |