3 Replies Latest reply on Feb 10, 2003 5:01 AM by Tony Green

    jb 3.0.4 / tc 4.1.12 as sysV service RH8

    Tony Green Newbie

      I am setting up jb-tc to run as a service under RH8.

      I took the startup scripts from the Quickstart guide. Edited them for my system, chmod'd them and set up the runlevel links.

      When I reboot RH reports that the daemon started okay but in fact, nothing happened.

      The bundle runs fine from run.sh by the way.

      Solutions and/or hints both gratefully received.


      ----------------------------------------------
      /etc/init.d/jboss:
      ----------------------------------------------
      #!/bin/sh
      #
      # Startup script for JBOSS, the J2EE EJB Server
      #
      # chkconfig: 2345 95 15
      # description: JBoss is an EJB Server
      # processname: jboss
      # pidfile: /var/run/jboss.pid
      # config: /usr/local/jboss/conf/default/jboss.conf
      # logfile: /usr/local/jboss/log/server.log
      #
      # version 1.0 -
      # version 1.1 - kjenks - Start Tomcat, too.
      #
      # Source function library.
      . /etc/rc.d/init.d/functions
      #SET THE FOLLOWING LINE TO YOUR JAVA_HOME
      export JAVA_HOME=/usr/java/j2sdk1.4.1_01

      #SET THE FOLLOWING LINE TO YOUR CORRECT JBOSS_HOME
      export JBOSS_HOME=/usr/local/jboss-3.0.4_tomcat-4.1.12

      export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

      #IF YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH
      #AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE

      #export CLASSPATH=

      RETVAL=0

      # See how we were called.
      case "$1" in
      start)
      echo "jboss startup starting up"
      cd $JBOSS_HOME/bin
      echo -n "Starting jboss daemon: "
      daemon $JBOSS_HOME/bin/go.sh start
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && touch /var/lock/subsys/jboss
      ;;
      stop)
      echo -n "Stopping jboss daemon: "
      killproc jboss
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/jboss
      ;;
      restart)
      echo -n "Restarting jboss daemon: "
      $0 stop
      sleep 2
      $0 start
      ;;
      esac


      -----------------------------------------------
      /usr/local/jboss-3.0.4_tomcat-4.1.12/bin/go.sh:
      -----------------------------------------------
      #!/bin/sh
      #
      # go.sh
      # Shell script to start and stop integrated Tomcat/jBoss
      export JBOSS_HOME=/usr/local/jboss-3.0.4_tomcat-4.1.12
      export JAVA_HOME=/usr/java/j2sdk1.4.1_01

      JAVACMD=$JAVA_HOME/bin/java

      # Minimal jar file to get JBoss started.
      CLASSPATH=$CLASSPATH:$JBOSS_HOME/bin/run.jar

      # Add the tools.jar file so that Tomcat can find the Java compiler.
      CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"

      if [ "$1" = "start" ] ; then
      echo "jboss go.sh is starting"
      shift
      $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main -c tomcat > /dev/null 2>&1 &
      echo $! > /var/run/jboss.pid

      elif [ "$1" = "stop" ] ; then
      shift
      kill -15 `cat /var/run/jboss.pid`
      rm -rf /var/run/jboss.pid

      elif [ "$1" = "run" ] ; then
      shift
      $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main -c tomcat "$@"

      else
      echo "Usage:"
      echo "jboss (start|run|stop)"
      echo " start - start jboss in the background"
      echo " run - start jboss in the foreground"
      echo " stop - stop jboss"
      exit 0
      fi

        • 1. I can see where it's getting its knickers in a twist...
          Tony Green Newbie

          I just can't see where to fix it...

          I extracted the exception from go.sh and found that:

          org.jboss.deployment.DeploymentException: url file:/usr/local/jboss-3.0.4_tomcat-4.1.12/server/tomcat/conf/jboss-service.xml could not be opened, does it exist?
          at org.jboss.deployment.DeploymentInfo.(DeploymentInfo.java:178)
          ...etc.

          Well I seem to have a whole pile of jboss-service.xml files at various locations (see below). So what's gone wrong here, really?

          ....... more detail than you really need follows .........

          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/all/conf/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/all/deploy/http-invoker.sar/META-INF/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/all/deploy/jmx-rmi-adaptor.sar/META-INF/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/conf/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/http-invoker.sar/META-INF/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/jmx-rmi-adaptor.sar/META-INF/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/tmp/deploy/server/default/conf/jboss-service.xml
          /usr/local/jboss-3.0.4_tomcat-4.1.12/server/minimal/conf/jboss-service.xml

          • 2. ... continuing problems ...
            Tony Green Newbie

            By the way - there are a couple of errors in the init.d script I originally posted the 'magic comments' for config and logfile weren't set to anything meaningful. I fixed this as :

            # config: /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/conf/jboss-service.xml
            # logfile: /usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/log/server.log
            #
            Actually, to be honest, I don't really understand how and why these magic comments are used but it doesn't seem to help because I still get the deployment exception, ie:

            org.jboss.deployment.DeploymentException: url file:/usr/local/jboss-3.0.4_tomcat-4.1.12/server/tomcat/conf/jboss-service.xml could not be opened, does it exist?


            My two current guesses at the moment are:
            1) the bundle zip file does not correctly create the JBOSS_HOME/server/tomcat directory structure. I think this may be the case because the other three server directories (all,default and minimal) all contain a conf directory and the tomcat one doesn't.
            2) the startup process is reading a primordial configuration file that's misconfigured.

            Is it all right if I shout now?

            HELP! HELP! HELP!

            • 3. I may be talking to myself, here ...
              Tony Green Newbie

              ...but that doesn't necessarily mean I'm mad.

              It turns out the real problem is in the example go.sh in the (mysteriously entitled) Quick Start Guide.

              The line that starts the server is:
              $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main -c tomcat > /dev/null 2>&1 &

              Because the 'tomcat' server configuration is, in some sense, not a well formed configuration directory in the current distro (ie jboss-3.0.4_tomcat-4.1.12).

              All you have to do (apart from fixing up all the relevant pathnames for your system and installing the runlevel symlinks) is to change the value 'tomcat' to 'default' or your own config directory in the server start command.

              BTW in a week or so I plan to post a tutorial on how to get jboss/tomcat/apache running 'properly' under RedHat on my consultancy website but if anyone wants me to post an early copy here I would be quite happy to do that.