Running Servoy Server on a Mac

I’m attempting to set up a Mac (10.4.5) as a Servoy Server and running into permissions difficulties. I’ve followed Marcel Trapman’s tutorial on Servoy Magazine and I’ve used Robert Ivens sample files. Yet neither Servoy Server nor Sybase ASA launches.

Here’s why I suspect it’s a permissions issue:

Last login: Fri Feb 17 10:06:41 on console
Welcome to Darwin!
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/StartupParameters.plist
-bash: /Library/StartupItems/Servoy/StartupParameters.plist: Permission denied
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/Servoy
-bash: /Library/StartupItems/Servoy/Servoy: Permission denied
s-power-mac-g4:~ 466$

In order to create the Servoy folder and add Robert’s files to the /Library/StartupItems folder I switched ownership to myself (466). At the conclusion of which I switched everything back to its original status – owner is “system” which alone has read/write permission.

Otherwise I’m using Robert’s files (which work for him), none of which appears to have anything which is specific to his system. And I’ve followed Marcel’s tutorial to the letter.

By the way, this is a virgin Mac G4, freshly installed OS (10.4.5), Java J2SE 5.0 Release 3, Servoy 2.4.4, new hard drive with nothing else on it.

For reference here’s links.
Marcel’s tutorial http://www.servoymagazine.com/home/2004 … w_to_.html
Robert’s files http://www.roclasi.com/download/OSX_startup.zip

Kind regards,

Try this:

chmod a+x /Library/StartupItems/Servoy/Servoy

If it doesn’t work post the listing of your /Library/StartupItems/Servoy folder so we can see the privileges.

And remember that the start command is:

/Library/StartupItems/Servoy/Servoy start

and must be executed by the root user cause it writes on console.

Hi Morley,

Can you go into the Terminal and fire the following command and copy/paste the result back into this thread please.

ls -al /Library/StartupItems/Servoy/

Thanks for the hints Nicola and Robert. Here’s the results of your requests. First the Terminal

Last login: Fri Feb 17 10:06:41 on console
Welcome to Darwin!
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/StartupParameters.plist
-bash: /Library/StartupItems/Servoy/StartupParameters.plist: Permission denied
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/Servoy
-bash: /Library/StartupItems/Servoy/Servoy: Permission denied
s-power-mac-g4:~ 466$ ls -al /Library/StartupItems/Servoy/
total 32
drwxr-xr-x 5 root wheel 170 Feb 17 09:35 .
drwxr-xr-x 4 root wheel 136 Feb 17 09:31 ..
-rw-r–r-- 1 root wheel 6148 Feb 17 09:40 .DS_Store
-rwxr–r-- 1 root wheel 416 Dec 12 2004 Servoy
-rwxr–r-- 1 root wheel 237 Dec 12 2004 StartupParameters.plist
s-power-mac-g4:~ 466$ chmod a+x /Library/StartupItems/Servoy/
s-power-mac-g4:~ 466$ ls -al /Library/StartupItems/Servoy/
total 32
drwxr-xr-x 5 root wheel 170 Feb 17 09:35 .
drwxr-xr-x 4 root wheel 136 Feb 17 09:31 ..
-rw-r–r-- 1 root wheel 6148 Feb 17 09:40 .DS_Store
-rwxr–r-- 1 root wheel 416 Dec 12 2004 Servoy
-rwxr–r-- 1 root wheel 237 Dec 12 2004 StartupParameters.plist
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/
-bash: /Library/StartupItems/Servoy/: is a directory
s-power-mac-g4:~ 466$ /Library/StartupItems/Servoy/Servoy start
-bash: /Library/StartupItems/Servoy/Servoy: Permission denied
s-power-mac-g4:~ 466$

And here’s the Console:

Mac OS X Version 10.4.5 (Build 8H14)
2006-02-17 10:06:57 -0500
2006-02-17 10:07:04.383 SystemUIServer[167] lang is:en
kextload: /System/Library/Extensions/smbfs.kext loaded successfully
mount_smbfs: no shares found

Fairly obviously, I don’t believe I’m the host, or that when this Mac is started up it doesn’t believe it has host privileges to run what’s in the /Library/StartupItems/ directory.

This is a refurbished used G4. When I first fired it up this past Thursday it had a single account “466”. I added my name to that account and password but the “466” name hasn’t gone away. I also required that on boot it require a password. Simply being cautious.

There’s something mysterious (to me) going on here. I don’t meddle with system-level stuff (or the Terminal) frequently enough for the concepts to lodge cleanly and clearly to my mind.

Your assistance very welcome. :D

Privileges are ok, you simply have to run the process as root:

sudo /Library/StartupItems/Servoy/Servoy start

ngervasi:
Privileges are ok, you simply have to run the process as root:

sudo /Library/StartupItems/Servoy/Servoy start

A few questions so I’ll know what’s going on here and what maintenance is required.

Do I need to enter that code into Terminal every time I start up this Mac?

If the permissions are fine, why is this line of code required?

Does this line of code transform the files in some way so they will execute themselves on their own thereafter when the Mac starts up?

Should this instruction have been added to Marcel Trapman’s tutorial on this subject?

This same Mac is having problems launching Servoy Developer (not that I want to use this machine for Developer very frequently, it bothers me that Developer doesn’t behave properly. The problem, as described in the thread at http://forum.servoy.com/viewtopic.php?t=5912, is Servoy doesn’t wait long enough for Sybase ASA to get started. Therefore Servoy Developer announces the Servoy repository isn’t available.

Another user privately recommended I create a startup item to start Sybase ASA whenever the machine is launched. Without telling me how exactly to do that, especially on this machine that, until now, has ignored the StartupItems folder.

In other words, without the whole story, the whole picture, I’m teased and still in the dark.

Cheers. :)

Should this instruction have been added to Marcel Trapman’s tutorial on this subject?

Maybe, maybe not. It worked fine for me and still does. I can imagine a whole bunch of variables among which:

  • what priviliges did the user you installed servoy with have
  • did you install in a root folder or a user folder

Another user privately recommended I create a startup item to start Sybase ASA whenever the machine is launched. Without telling me how exactly to do that, especially on this machine that, until now, has ignored the StartupItems folder.

Can be that I missed something but I have never ever heard of a StartupItems folder being ignored. Whan I can imagine though is:

  • the startup item is not seen as an executable piece of code (especially with .sh scripts)
  • there are at least two of these folders. One belongs to the system the other to the user(s) maybe the item is in the wrong position.

Hi Morley,

These are your permissions:

-rwxr--r--   1 root  wheel  416 Dec 12  2004 Servoy
-rwxr--r--   1 root  wheel  237 Dec 12  2004 StartupParameters.plist

These are mine:

-rwxr-xr-x   1 root  wheel  416 Dec 10  2004 Servoy
-rw-r--r--   1 root  wheel  237 Nov 28  2004 StartupParameters.plist

See the difference?

You are still missing some permissions.
This is all explained before on this forum.
Just follow it step by step.

ROCLASI:
These are your permissions:

-rwxr--r--   1 root  wheel  416 Dec 12  2004 Servoy

-rwxr–r-- 1 root wheel 237 Dec 12 2004 StartupParameters.plist



These are mine:


-rwxr-xr-x 1 root wheel 416 Dec 10 2004 Servoy
-rw-r–r-- 1 root wheel 237 Nov 28 2004 StartupParameters.plist



See the difference?

You are still missing some permissions.

I’m not a Unix geek. So I’ve been attempting to achieve your configuration using Get Info. Have failed. Sorry, in previous discussions on this theme I couldn’t locate the appropriate terminal command to achieve it.

Morley, time to google for info I would say. Searching for ‘mac permission’ gave me 19.300.000 hits in 0.19 seconds. The first hits on the first page will help you understand as well as change permissions…

Still having problems.

Fixed the permissions and tried ```
sudo /Library/StartupItems/Servoy/Servoy start


> Last login: Sun Feb 19 15:16:03 on console
> Welcome to Darwin!
> s-power-mac-g4:~ 466$ sudo /Library/StartupItems/Servoy/Servoy start
> Password:
> Starting Servoy Application Server...
> s-power-mac-g4:~ 466$ Loading servoy.properties from /Applications/Servoy/servoy.properties
> Loading - Done
> Using RMI registry on port 1099
> Starting service Tomcat-Standalone
> Apache Tomcat/4.0.1
> Starting service Tomcat-Apache
> Apache Tomcat/4.0.1
> 
> s-power-mac-g4:~ 466$ ls -al /Library/StartupItems/Servoy/
> total 32
> drwxr-xr-x 5 root wheel 170 Feb 17 09:35 .
> drwxr-xr-x 4 root wheel 136 Feb 17 09:31 ..
> -rw-r--r-- 1 root wheel 6148 Feb 17 09:40 .DS_Store
> -rwxr-xr-x 1 root wheel 416 Dec 12 2004 Servoy
> -rwxr--r-- 1 root wheel 237 Dec 12 2004 StartupParameters.plist
> s-power-mac-g4:~ 466$

Remember this is a virgin Mac, no legacy to throw it off course. I'm using Robert Ivens files and Marcel Trapman's tutorial to the letter. 

There's no sign of Sybase in the Activity Monitor, which would suggest Servoy Server may have launched but didn't wait long enough for Sybase, therefore didn't find the Servoy repository.

This error happens when I attempt to launch Servoy Developer. Servoy tells me there's no repository. If I then quit Servoy and then launch Developer a second time it loads properly. 

I suspect the files in the StartupItems need to be modified in some way to launch Sybase well ahead of Servoy.

Am greatly puzzled.

I don’t see any ‘permissions denied’ anymore as well as a properly started tomcat server…
What do I miss here? The only thing I don’t see is your Sybase db starting up…

IT2BE:
I don’t see any ‘permissions denied’ anymore as well as a properly started tomcat server…
What do I miss here? The only thing I don’t see is your Sybase db starting up…

Exactly! Sybase doesn’t start up. Don’t know why.

When I launch Developer Servoy triggers Sybase to launch but doesn’t wait for it to complete the process. Servoy tells me there’s no repository. If I then quit Servoy and launch it a second time Servoy then finds the repository and loads properly.

But in the case of ```
sudo /Library/StartupItems/Servoy/Servoy start


Not sure where to turn now.

So what does your startup script look like?

Hi Morley,

Does your servoy_server.sh look like this?

#!/bin/sh

cd /Applications/Servoy
export DYLD_LIBRARY_PATH=/Applications/Servoy/sybase_db
/Applications/Servoy/sybase_db/dbsrv9 @/Applications/Servoy/sybase_db/sybase.config &

while true
do
        java -Djava.awt.headless=true -classpath .:lib/commons-collections.jar:lib/commons-dbcp.jar:lib/commons-pool.jar:lib/activation.jar:lib/antlr.jar:lib/j2db.jar:lib/j2dbdev.jar:lib/compat141.jar:lib/jh.jar:lib/jndi.jar:lib/js.jar:lib/jta.jar:lib/mail.jar:lib/jug.jar:lib/jdbc2_0-stdext.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/xerces.jar:lib/server-bootstrap.jar:lib/commons-fileupload-1.0.jar:lib/commons-logging.jar:lib/hibernate2.jar com.servoy.j2db.server.ApplicationServer "$@"
        EXITCODE=$?
        if [ "$EXITCODE" != 99 ]; then exit $EXITCODE; fi
done

Notice the first block of code.

Without any linefeeds in the startup line(s)?

IT2BE:
Without any linefeeds in the startup line(s)?

Who are you asking ?

Morley, because it works at your place so I assume you know it should be without linefeeds :)

True, but that is only for the (long) startup line for Servoy, but that seems to work for Morley.
I somehow suspect he doesn’t have the first bit of this script. The part that launches Sybase. And that does have linefeeds :)

Btw Morley. This startup script is also in the package that you downloaded from my server (and discussed in the thread I mentioned a few messages ago).

Quick answer to Robert. The Servoy_Server.sh script appears to be identical with yours.

Time for a thorough review.

The Mac is a 466Mhz PowerPC G4, 512Mb SDRAM, running 10.4.5. Java is J2SE 5.0 release 3. The machine is refurbished, less than a week in my hands. The OS is freshly installed. The hard drive is new. Until last Wednesday this machine had never seen Servoy or Sybase ASA.

First thing I did was downloaded the installer for Servoy 2.2.4. Installed it in the default location. On booting into Developer I discovered Servoy couldn’t find its repository. Eventually discovered that if I quit Servoy (but not Sybase) and then launched Servoy Developer a second time it would find its repository. A timing issue, Servoy isn’t waiting long enough for Sybase to come up to speed. I’d like to get this problem fixed, but running Developer is NOT the main purpose of this Mac. However this timing issue could be a factor with running Servoy Server. Don’t know for sure, just a possible factor at this stage.

Next installed my seven_office.db, the 7Office solution, added the Servoy license, etc. Ran Developer again and everything in 7Office looked normal.

Next reviewed my notes from setting up an Xserve last spring as a Servoy Server. I had major problems that time as well. At the time I was still relatively green with Servoy, but with help from both Marcel Trapman and Robert Ivens, and a local friend we eventually got it running. To this day I don’t know what turned the trick, but I do know that it works reliably and that it’s not doing it by running StartupItems in the way Marcel describes. But it works. So I haven’t visited it, haven’t fiddled with it this past week. The Xserve will continue to run as the production server. This G4 will be an independent server for the 7Office demo.

The major highlights of my notes from last spring was Marcel’s Servoy Magazine tutorial. I also discovered Robert’s sample files were still available for download. I then followed Marcel’s tutorial, but used Bob’s files. Just dragged them into place.

Next discovered there was a permissions problem with the files in the /Library/StartupItems/Servoy/ directory. After some additional research I discovered how to change those (don’t have that technique memorized because I do that at most, if that, once a year). Sent Marcel a proposed ammendment for his tutorial on this theme.

All right, try it again. Nothing, nothing at all, although permissions appear to be correct. I then tried Nicola Gervasi’s recommendation (earlier in this thread).

sudo /Library/StartupItems/Servoy/Servoy start
```It seems to start Tomcat but it doesn't start Sybase. This time I'd really rather have things working in the standard, automatic and reliable way than jury rigging a workaround solution.

Here then are various diagnostics and screenshots.

Permissions for Startup Items: 

> Last login: Sun Feb 19 15:22:08 on ttyp1
> Welcome to Darwin!
> s-power-mac-g4:~ 466$ ls -al /Library/StartupItems/
> total 16
> drwxr-xr-x 4 root wheel 136 Feb 17 09:31 .
> drwxrwxr-t 43 root admin 1462 Feb 17 09:29 ..
> -rw-r--r-- 1 root wheel 6148 Feb 17 09:37 .DS_Store
> drwxr-xr-x 5 root wheel 170 Feb 17 09:35 Servoy
> s-power-mac-g4:~ 466$ ls -al /Library/StartupItems/Servoy/
> total 32
> drwxr-xr-x 5 root wheel 170 Feb 17 09:35 .
> drwxr-xr-x 4 root wheel 136 Feb 17 09:31 ..
> -rw-r--r-- 1 root wheel 6148 Feb 17 09:40 .DS_Store
> -rwxr-xr-x 1 root wheel 416 Dec 12 2004 Servoy
> -rwxr--r-- 1 root wheel 237 Dec 12 2004 StartupParameters.plist
> s-power-mac-g4:~ 466$

Permissions for /Applications/Servoy/ 

> s-power-mac-g4:~ 466$ cd /Applications/Servoy/
> s-power-mac-g4:/Applications/Servoy 466$ ls -al 
> total 80
> drwxr-xr-x 20 466 admin 680 Feb 20 08:47 .
> drwxrwxr-x 30 root admin 1020 Feb 16 16:32 ..
> -rw-r--r-- 1 466 admin 6148 Feb 20 08:47 .DS_Store
> -rw-r--r-- 1 466 admin 6525 Feb 16 17:20 .log.txt
> drwxr-xr-x 4 466 admin 136 Apr 11 2003 Servoy.app
> drwxr-xr-x 3 466 admin 102 Feb 16 16:33 Uninstaller
> drwxr-xr-x 8 466 admin 272 Feb 16 16:33 beans
> drwxr-xr-x 15 466 admin 510 Feb 16 16:47 database
> drwxr-xr-x 5 466 admin 170 Feb 16 16:33 docs
> drwxr-xr-x 6 466 admin 204 Feb 16 16:32 drivers
> drwxr-xr-x 4 466 admin 136 Feb 16 16:33 lafs
> drwxr-xr-x 31 466 admin 1054 Feb 16 16:33 lib
> drwxr-xr-x 27 466 admin 918 Feb 16 16:33 plugins
> drwxr-xr-x 8 466 admin 272 Feb 17 09:46 server
> -rw-r--r-- 1 466 admin 5354 Feb 16 17:20 servoy.properties
> -rw-r--r-- 1 466 admin 4832 Feb 7 10:00 servoy_developer.jar
> -rwx------ 1 466 admin 773 Dec 12 2004 servoy_server.sh
> drwxr-xr-x 3 466 admin 102 Feb 16 16:33 solutions
> drwxr-xr-x 17 466 admin 578 Feb 16 16:49 sybase_db
> -rwxr-xr-x 1 466 admin 607 Jul 6 2004 unmodified servoy_server.sh
> s-power-mac-g4:/Applications/Servoy 466$

Permissions for servoy_server.sh look suspicious. Not sure what they should be.

Here's the contents of various files. I may have made an error in copying but they're all from Robert Ivens.

/Library/StartupItems/Servoy/Servoy : 

> #!/bin/sh
> ##
> # Servoy Application Server
> ##
> . /etc/rc.common 
> StartService () {
> ConsoleMessage "Starting Servoy Application Server..."
> cd /Applications/Servoy/
> . /Applications/Servoy/servoy_server.sh&
> } 
> StopService()
> {
> ConsoleMessage "In the future Stop Servoy Application Server here"
> }
> RestartService ()
> {
> ConsoleMessage "Restarting Servoy Application Server..."
> StopService
> StartService
> }
> RunService "$1"

/Library/StartupItems/Servoy/StartupParameters.plist : 

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

/Applications/Servoy/servoy_server.sh : 

> #!/bin/sh
> 
> cd /Applications/Servoy
> export DYLD_LIBRARY_PATH=/Applications/Servoy/sybase_db
> /Applications/Servoy/sybase_db/dbsrv9 @/Applications/Servoy/sybase_db/sybase.config &
> 
> while true
> do
> java -Djava.awt.headless=true -classpath .:lib/commons-collections.jar:lib/commons-dbcp.jar:lib/commons-pool.jar:lib/activation.jar:lib/antlr.jar:lib/j2db.jar:lib/j2dbdev.jar:lib/compat141.jar:lib/jh.jar:lib/jndi.jar:lib/js.jar:lib/jta.jar:lib/mail.jar:lib/jug.jar:lib/jdbc2_0-stdext.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/xerces.jar:lib/server-bootstrap.jar:lib/commons-fileupload-1.0.jar:lib/commons-logging.jar:lib/hibernate2.jar com.servoy.j2db.server.ApplicationServer "$@"
> EXITCODE=$?
> if [ "$EXITCODE" != 99 ]; then exit $EXITCODE; fi
> done

/Applications/Servoy/sybase_db/sybase.config : 

> -ti 0 -x tcpip{dobroadcast=no} -ud -qs -qw -o sybase_db/sybase_log.txt
> database/servoy_repository.db
> database/user_data.db
> database/example.db
> database/log_data.db
> database/seven_office.db
> database/crm.db

Now shut down, let it settle for a few minutes. Then startup again, give it a few minutes to come up to speed and test.

After a restart I find that dbsrv9 __*is*__ running but I'm **unable to access servoy-admin**.

Console reads: 

> Mac OS X Version 10.4.5 (Build 8H14)
> 2006-02-20 09:37:21 -0500
> 2006-02-20 09:37:27.477 SystemUIServer[171] lang is:en

I now run Nicola Gervasi's kickstart again. 

sudo /Library/StartupItems/Servoy/Servoy start


> Last login: Mon Feb 20 09:37:15 on console
> Welcome to Darwin!
> s-power-mac-g4:~ 466$ sudo /Library/StartupItems/Servoy/Servoy start
> Password:
> Starting Servoy Application Server...
> s-power-mac-g4:~ 466$ Loading servoy.properties from /Applications/Servoy/servoy.properties
> Loading - Done
> Using RMI registry on port 1099
> Starting service Tomcat-Standalone
> Apache Tomcat/4.0.1
> Starting service Tomcat-Apache
> Apache Tomcat/4.0.1

Wait a few minutes and test. I'm now able to launch <a class="postlink" href="http://192.168.2.11:8080/servoy-admin">http://192.168.2.11:8080/servoy-admin</a>

This works, after a fashion, but has to be manually forced. Hardly elegant or user friendly.

The only suspect I've spotted are the permissions for servoy_server.sh. Are they correct? What should they be?