6 Replies Latest reply on Sep 24, 2002 7:38 AM by mathpets

    Loading Jboss as service on Linux 7.1

    roadster

      HI,

      I am sure this has been asked before but I am trying to get Jboss to load automatically when Linux boots. I have written a shell script that works fine when I run it manually after my machine comes up. But when the same script is called via the init.d & init.? symlinks then I get this error output in the logs....

      Mar 8 14:12:26 Demeter jbosstomcat: Starting jboss daemon:
      Mar 8 14:12:26 Demeter jbosstomcat: JBOSS_CLASSPATH=:/lib/tools.jar:run.jar:../lib/crimson.jar
      Mar 8 14:12:27 Demeter jbosstomcat: Couldn't find or load essential class `java/lang/Object' java.lang.NoClassDefFoundError java/l$
      Mar 8 14:12:27 Demeter jbosstomcat:
      Mar 8 14:12:27 Demeter jbosstomcat: ./run.sh: line 27: 830 Aborted java $HOTSPOT $JAXP -classpath $JBOSS_CLASSPA$
      Mar 8 14:12:27 Demeter rc: Starting jbosstomcat: failed

      I am somewhat new to Linux so I have read all I can get my hands on but I have to confess to spinning my wheels. As I said my script works fine when run manually from the same init.d directory?

      I have gotten all other aspects of my setup working just fine. I just can't get this to load on its own when the server comes up.

      If anyone can share their setup and script to do the same it would be GREATLY, GREATLY. appreciated. I am using the jboss 2.4, Tomcat 3.2.3, Linux 7.1 and SUN's 1.3.1_02 etc

      Signed.... out of ideas.

        • 1. Re: Loading Jboss as service on Linux 7.1
          rgjawanda

          Do you have your environment set for the 'root' user?

          ie:
          JAVA_HOME most likely isn't set.

          I would add a wraper around the run.sh

          call it start_jboss.sh
          Set JAVA_HOME
          set all ENV's

          Maybe something like this: Then enter run.sh



          export CATALINA_HOME=/usr/local/JBoss-2.4.4_Tomcat-4.0.1/catalina
          export TOMCAT_HOME=/usr/local/JBoss-2.4.4_Tomcat-4.0.1/catalina
          export SERVLETAPI_HOME=/usr/local/JBoss-2.4.4_Tomcat-4.0.1/catalina/common/lib
          export JBOSS_DIST=/usr/local/JBoss-2.4.4_Tomcat-4.0.1/jboss
          PATH=$PATH:$HOME/bin:/usr/local/j2sdk1.4.0/bin:/usr/local/j2sdk1.4.0/bin:/usr/lo
          cal/jakarta-ant-1.4.1/bin:/usr/local/jakarta-ant-1.4.1:/usr/local/zip
          export JAVA_HOME=/usr/local/j2sdk1.4.0
          export J2EE_HOME=/usr/local/j2sdkee1.3.1
          export CLASSPATH=/usr/local/jakarta-ant-1.4.1/lib/ant.jar:/usr/local/jakarta-ant
          -1.4.1/lib/crimson.jar:/usr/local/jakarta-ant-1.4.1/lib/jaxp.jar:/usr/local/jaka
          rta-ant-1.4.1/lib/jakarta-ant-1.4.1-optional.jar:$JAVA_HOME/lib/tools.jar:$SERVL
          ETAPI_HOME/servlet.jar
          ./run.sh



          • 2. Re: Loading Jboss as service on Linux 7.1
            furick1

            Init scripts run for /etc/init.d/ . In your classpath you reference a jar bia ../../ . That relative referencing implies that you are currently in $JBOSS_HOME not /etc/init.d . You have to fix the relative references in that file and elsewhere. I think the defaults config file has relative refrencing as well.

            I had this same problem occur and can use the init script to start but stopping isn't working. Have to do kill -9 to stop it. There is something wrong with how the daemon is being started and it isn't releasing tty.

            • 3. Re: Loading Jboss as service on Linux 7.1
              furick1

              sorry I meant $JBOSS_HOME/bin

              • 4. Re: Loading Jboss as service on Linux 7.1
                jwkaltz

                > I had this same problem occur and can use the init
                > script to start but stopping isn't working. Have to
                > do kill -9 to stop it. There is something
                > wrong with how the daemon is being started and it
                > isn't releasing tty.

                If you look at the bin/run.sh in JBoss 2.4.4 you will notice JBoss is not a daemon, but a Java program running in the foreground.
                If you want to be able to stop it from another script, you should
                1. run java in the background, i.e. add an ampersand to the end of the last line in run.sh

                2. Save the PID jboss was started as. You can do this e.g. by adding this line after the "java ..." stuff:
                echo $! > <some-path>/jboss.pid

                where you replace <some-path> by some path where you can write to

                3. Create a stop.sh script for jboss with this content :
                PID_FILE=<some-path>/jboss.pid
                kill `cat $PID_FILE`
                rm -rf $PID_FILE

                4. Call this script from your /etc/init.d shutdown stuff.

                (if you ask me, the jboss distribution should already have all that stuff)

                Note:
                You should never do a "kill -9" on your web services !! You won't get a clean shutdown, maybe resources such as db connections won't be released, and so on !!


                • 5. Re: Loading Jboss as service on Linux 7.1
                  skrabler

                  The last post is simlar to what I did. Here's the files.

                  • 6. Re: Loading Jboss as service on Linux 7.1
                    mathpets

                    I have a very stupid question but I really need someone's help.

                    I have put the jbossstart script in the /etc/init.d directory. I have changed the script to run run_with_catalina.sh instead. I have also created a soft link in the file /etc/r3.d/S99jboss to /etc/init.d/jboss.

                    When I run the script by typing at the promot '/etc/init.d/jboss start', it starts up fine. However, I still cannot start JBoss when the Linux starts.
                    Am I missing some steps? Any help will be deeply appreciated. Thank you so much!