Server 3.0 runs fine, but won't start at startup on Mac OS X

Just upgraded from Servoy 2 to 3 on Mac OS X. Other than a twice-failed repository upgrade, it went fine (repository is in MySQL, and it wasn’t a big deal to just start fresh).

Now, I can start Servoy Server from either the developer or a command line in the Terminal. However, the old startup item (LaunchAgent) refuses to start Server on startup! I get the following repeated 10 times in servoy.log:

java.lang.NoClassDefFoundError: com/servoy/j2db/server/ApplicationServer

And the system console.log shows an appropriate variation of this 10 times in a row before finally giving up:

launchd[444]: Servoy Server: exited with exit code: 1
launchd[444]: Servoy Server: respawning too quickly! throttling
launchd[444]: Servoy Server: 9 more failures without living at least 60 seconds will cause job removal
launchd[444]: Servoy Server: will restart in 10 seconds

I have the following servoy.plist in /System/Library/LaunchAgents:

<?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>Servoy Server</string>
		<key>OnDemand</key>
		<false/>
		<key>Program</key>
		<string>/Applications/Servoy/servoy_server.sh</string>
		<key>ProgramArguments</key>
		<array>
		<string>/Applications/Servoy/servoy_server.sh</string>
		</array>
		<key>RunAtLoad</key>
		<true/>
		<key>ServiceDescription</key>
		<string>Launch item for Servoy Server</string>
</dict> 
</plist>

Again, this is untouched since version 2.x, when it worked. I did a clean install of Servoy 3, but it is in the same location as version 2. And also, to reiterate, Server has no problem starting up manually.

Thanks in advance for any insight!

Hmm, this looks like there is something wrong with the ClassPath or the Build of Servoy. The main class can not be found.

I think that the problem lies in the fact that you are running the shell script without CDing in the Servoy directory, take a look at my Servoy Startup script:

#!/bin/sh
##
# Servoy Application Server
#

. /etc/rc.common

StartService ()
{
        ConsoleMessage "Starting Servoy Application Server..."
        cd /Applications/Servoy3
        . /Applications/Servoy3/servoy_server.sh &
}

StopService ()
{
        ConsoleMessage "Stopping Servoy Application Server"
        PIDS=`ps ax | grep servoy_server.sh | grep -v grep | awk '{print $1}'`

        for pid in $PIDS; do
        kill -KILL $pid
        done
}

RestartService ()
{
        ConsoleMessage "Restarting Servoy Application Server..."
        StopService
        StartService
}

RunService "$1"

Nicola, your startup script is obviously completely different than mine. Is this the new preferred way to start Servoy Server on startup? And, most importantly, where do you put this script?

This is a classic MacOSX startup script. You need to create the dir /Library/StartupItems/Servoy and put 2 files in it:

Servoy
StartupParameters.plist

The first file is the startup script I posted earlier, the second file is this:

{
  Description     = "Servoy Application Server";
  Provides        = ("Servoy");
  Requires        = ("Resolver");
  OrderPreference = "Late";
  Messages =
  {
    start = "Starting Servoy Application Server";
    stop  = "Stopping Servoy Application Server";
  };
}

Or do as I do.

I use Lingon to create the startup items. Really fantastic!

Obligatory link:

http://lingon.sourceforge.net/

Use it, you’ll love it.

Hi,
I have downloaded lingon and it looks fairly straight forward, but i just cant seem to get this thing fired up!

I have set up a User Agent and told it to run the following three lines on startup:

/bin/sh
cd /Applications/Servoy
./servoy_server.sh&

This works if i type it into a shell and starts servoy successfully, but it comes back with no such directory when i run it, even though this works when typed directly into a terminal window.

I know i am missing something really basic.

Your help and guidance would as always be appreciated.

David
[/code]

dpearce:

/bin/sh

cd /Applications/Servoy
./servoy_server.sh&

Try this:

#!/bin/sh
cd /Applications/Servoy
. /Applications/Servoy/servoy_server.sh &

Thanks,

It doesnt seem to like the #

then when i remove it it just exits with code 127

yet when i type the three lines into my default bash shell then it works fine!!!

Its a bit out of my depth, but doesnt look like it should be this hard
When i try the more traditional startup items way then it simply says it cant execute the file Servoy, yet i have check the files and the plist files and the permissions against everything thats out there and they all seem aligned!!!

Any more clues? Is it the way my default terminal is set up maybe?

David

Got it working with the startup items instead.

Very odd, after six hours of messing around i tried by duplicating a mysql startup script and pasting in the recommend stuff into it.

It worked first time. The weird thing is i am sure i did this last night creating my own script and they wouldnt execute. I am sure i got all the ownerships and permissions correct as well.

Anyway thats the way it goes sometimes!!!

Thanks for your help.

David