0

I have Glassfish 3.1.2 installed on Ubuntu, I've set up a separate "glassfish" user to run it as and have JDK 1.7.0 installed. If I log in as the "glassfish" user and start GF via the shell:

/usr/local/java/glassfish/glassfish-3.1.2/glassfish/bin/asadmin start-domain domain1

It starts up fine, so I think I have everything installed ok. The problem is trying to start it with the following init.d script:

#! /bin/sh
export AS_JAVA=/usr/local/java/jdk1.7.0
GLASSFISHPATH=/usr/local/java/glassfish/glassfish-3.1.2/glassfish/bin

case "$1" in
start)
echo "starting glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo "stopping glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $"usage: $0 {start|stop|restart}"
exit 3
;;
esac
:

On trying that I get:

exec: 54: java: not found

I've also tried adding the following line to the init.d script:

export PATH=/usr/local/java/jdk1.7.0/bin:$PATH

But that didn't seem to do anything. I've been using instructions on http://www.nabisoft.com/tutorials/glassfish/installing-glassfish-301-on-ubuntu to get this far. As someone more familiar with Windows I'd really appreaciate any help identifying the problem. Thanks.

1 Answer 1

1

It would take a little tracing to figure out what's setting the path but an easy way is to edit asadmin. It's a shell script and you can set the full path to java in there.

2
  • Good tip, I might resort to that, although I'd still like to try and understand why it isn't working at the moment. If nothing else comes up in the next day or two I'll accept this as the answer. Apr 24, 2012 at 8:08
  • For tracing, I would look at the sudo stage. Print the environment from the init.d script and then again at the top of the asadmin script. I usually use su from init.d scripts.
    – JOTN
    Apr 25, 2012 at 0:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .