2 Replies Latest reply on Apr 24, 2005 7:49 AM by Darryl Miles

    Unable to start the Jboss service over init scripts.

    Nagaraj Narayan Newbie

      Hi Team,
      I'm unable to start the Jboss on init. I'm using Fedora Core 3 with JAVA 1.5. I copied the jboss_init_redhat.sh. when I start the service its doen't do anything other than echoing the CMD_START. The below is the script that use to start over init. Please help to resolve.
      -------------------
      JBOSS_HOME=${JBOSS_HOME:-"/SEEMIS/jboss-4.0.1"}

      #make java is on your path
      JAVAPATH=${JAVAPTH:-"/usr/java/jdk1.5.0_01/bin"}

      #define the classpath for the shutdown class
      JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}

      #define the script to use to start jboss
      JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c all"}

      if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
      # ensure the file exists
      touch $JBOSS_CONSOLE
      fi

      if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
      echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"
      echo "WARNING: ignoring it and using /dev/null"
      JBOSS_CONSOLE="/dev/null"
      fi

      #define what will be done with the console log
      JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}

      #define the user under which jboss will run, or use RUNASIS to run as the current user
      JBOSSUS=${JBOSSUS:-"jboss"}

      CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
      CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"

      if [ "$JBOSSUS" = "RUNASIS" ]; then
      SUBIT=""
      else
      SUBIT="su - $JBOSSUS -c "
      fi

      if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
      export PATH=$PATH:$JAVAPTH
      fi

      if [ ! -d "$JBOSS_HOME" ]; then
      echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
      exit 1
      fi


      echo CMD_START = $CMD_START


      case "$1" in
      start)
      cd $JBOSS_HOME/bin
      if [ -z "$SUBIT" ]; then
      eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
      else
      $SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"
      fi
      ;;
      stop)
      if [ -z "$SUBIT" ]; then
      $CMD_STOP
      else
      $SUBIT "$CMD_STOP"
      fi
      ;;
      restart)
      $0 stop
      $0 start
      ;;
      *)
      echo "usage: $0 (start|stop|restart|help)"
      esac
      ----------------------------------------------------------------------------

        • 1. Re: Unable to start the Jboss service over init scripts.
          Michael Ossareh Newbie

          Hi nagarajn

          "nagarajn" wrote:

          ...snip...
          JBOSS_HOME=${JBOSS_HOME:-"/SEEMIS/jboss-4.0.1"}

          #make java is on your path
          JAVAPATH=${JAVAPTH:-"/usr/java/jdk1.5.0_01/bin"}

          ...snip...
          if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
          export PATH=$PATH:$JAVAPTH
          fi
          ...snip...


          I might be completely wrong here but change the line
          JAVAPATH=${JAVAPTH:-"/usr/java/jdk1.5.0_01/bin"}

          to read
          JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.5.0_01/bin"}

          my logic for this is based on looking at the other part of the script that you posted (I still start jboss by hand!). E.g. the JBOSS_HOME line defines as so:
          JBOSS_HOME=${JBOSS_HOME:-"/SEEMIS/jboss-4.0.1"}

          you note that the variable at the start of the line is the spelt the same as the variable after the ${. In the case of $JAVAPATH it is not, throughout the script A is dropped from the PATH bit.

          I know bash scripting - and I've never see vars defined like this! So as I said earlier, this is an assumption right now!

          Let me/us know how it goes.


          • 2. Re: Unable to start the Jboss service over init scripts.
            Darryl Miles Novice

            First of all confirm that JBoss works with Java5 (1.5) I am using Blakedown 1.4.2 as I believe thsi is the correct version of VM to use JBoss reliably.

            http://www.jboss.org/wiki/Wiki.jsp?page=JBossInstallation

            As for shell substitutions check out:
            http://www.linuxselfhelp.com/gnu/bash/html_chapter/bashref_3.html#SEC29

            JAVAPATH=${JAVAPTH:-"/usr/java/jdk1.5.0_01/bin"}


            to read:

            JAVAPATH=${JAVAPATH:-"/usr/java/jdk1.5.0_01/bin"}


            that make more sense to me.


            FYI I use Fedora Code 3 and use the following to start JBoss as a script /opt/jboss-4.0.2RC1/mystart.sh:

            #!/bin/sh
            #
            JAVA_HOME="/opt/j2sdk1.4.2/"
            export JAVA_HOME
            
            PATH="${JAVA_HOME}/bin:$PATH"
            export PATH
            
            JAVA_OPTS="-client -Djboss.bind.address=172.16.32.38 -Dprogram.name=jboss"
            # -server
            # -Dprogram.name=
            # -Djboss.bind.address=jboss.home.darrylmiles.org
            #172.16.32.38
            # -Xmx100M
            # -Dhttp.port=8080 -Djndi.port=1700 -Duil2.port=1000"
            
            # openCRX says:
            JAVA_OPTS="${JAVA_OPTS} -Xms128m -Xmx512m"
            #JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
            JAVA_OPTS="${JAVA_OPTS} -Dorg.openmdx.compatibility.base.application.j2ee.domain=apps"
            JAVA_OPTS="${JAVA_OPTS} -Dorg.openmdx.compatibility.base.application.j2ee.server=server1"
            JAVA_OPTS="${JAVA_OPTS} -Djava.protocol.handler.pkgs=org.openmdx.kernel.url.protocol"
            JAVA_OPTS="${JAVA_OPTS} -Dorg.openmdx.log.config.filename=/opt/jboss-4.0.2RC1/server/default/server.log.properties"
            JAVA_OPTS="${JAVA_OPTS} -Dmail.SSLSocketFactory.class=org.openmdx.kernel.mail.SendMailSSLSocketFactory"
            #JAVA_OPTS="${JAVA_OPTS} -b 172.16.32.38"
            export JAVA_OPTS
            
            cd /opt/jboss-4.0.2RC1 || exit 1
            
            JBOSS_USER="jboss"
            export JBOSS_USER
            
            unset DISPLAY
            DISPLAY="odin:0"
            export DISPLAY
            
            cd bin
            exec ./run.sh -b 172.16.32.38 >../LOG.txt 2>&1