I need to launch a web service automatically on a RedHat server. The web service works and can be loaded manually through NetBeans.
Trying to make it so that the user only needs to perform a single command line or similar to get it running.
Started with getting GlassFish server up and running (used http://blogs.oracle.com/foo/entry/run_glassfish_v3_as_a mainly, with some input from other sources)
This led to me doing the following;
-Added new user
groupadd glassfish
useradd -s /bin/bash -d /home/glassfish -m -g glassfish glassfish
-Logged in as said user
sudo -i -u glassfish
-Installed glassfish
cd ~
unzip glassfish-v3.zip
rm glassfish-v3.zip
-Left the shell
-Copied in script to /etc/init.d and configured it as an executable
cp <script file as shown below> /etc/init.d/glassfish
chmod +x /etc/rc.d/init.d/glassfish
* THE SCRIPT *
#!/bin/sh
# Platform Services for GlassFish
#
GF_USER=glassfish
GF_HOME=/home/$GF_USER/glassfishv3/glassfish
ASADMIN=$GF_HOME/bin/asadmin
SU="su --login $GF_USER --command "
case "$1" in start)
$SU "$ASADMIN start-domain > /dev/null 2>&1 &";;stop)
$SU "$ASADMIN stop-domain > /dev/null 2>&1 &";;restart)
$SU "$ASADMIN restart-domain > /dev/null 2>&1 &";;\*)
echo "usage: $0 (start|stop|restart|help)"esac
Can start/stop/restart with;
sudo /etc/init.d/glassfish start|stop|restart
The problem is, I believe, that Glassfish is running but my little Java web service isn’t. I’m not surprised that the java web service isn’t running as I never included it in the above, but how do I set it up so that my web service is run?
I came in this morning and realised that I needed to deploy the java client. I did this by following the instructions from
http://download.oracle.com/docs/cd/E19798-01/821-1757/geyvr/index.html
For deploying applications automatically.
But now using this method my windows web-client can’t talk to my RedHat host, but they are perfectly happy when started manually.
The only difference I can think of is that the user on the Redhat machine when starting the services manually is “root” (which is a bit dangerous for a web application). But when starting the client automatically, it runs as a user… Of course this could be a complete red herring….
Any ideas guys?
Deploy your web service as an application in Glassfish.