9 Replies Latest reply on Mar 18, 2008 4:41 PM by Phanor Coll

    installing jboss AS 4.2 as a service in Debian lenny

    Phanor Coll Newbie

      How to install Jboss as a service on debian.Is there any predefined procedure and software to configure the jboss as a Service.

      i followed this tutorial

      http://wiki.jboss.org/wiki/Wiki.jsp?page=StartJBossOnBootWithLinux
      and
      http://demetrio812.blogspot.com/2007/10/install-jboss-as-421ga-on-debian.html

      when linux loads it show the messege "Starting jboss..", but when a log into my account and try in the browser http://localhost:8080, nothing happends

      please help in doing this.

        • 1. Re: installing jboss AS 4.2 as a service in Debian lenny
          Peter Johnson Master

          Does your startup script redirect the console log to a file? If so, post that. If not, post the last 50 or so lines from server/xxx/log/server.log.

          Also, have you tried running the init script manually using the root account? And have you tried manually running jbossas using the account specified in the init script?

          I have jbossas running as a service on my ubuntu box, so I know it should run just the same under debian.

          • 2. Re: installing jboss AS 4.2 as a service in Debian lenny
            Phanor Coll Newbie

            This is my init script, i ran the script manually using the root account, and it worked, it started jboss.

            but when i started linux it appears to be running, it show a process named java when i use ps -A, but when i try http://localhost:8080, it doesnt work..

            please help

            #!/bin/sh
            #
            # $Id: jboss_init_redhat.sh 60992 2007-02-28 11:33:27Z dimitris@jboss.org $
            #
            # JBoss Control Script
            #
            # To use this script run it as root - it will switch to the specified user
            #
            # Here is a little (and extremely primitive) startup/shutdown script
            # for RedHat systems. It assumes that JBoss lives in /usr/local/jboss,
            # it's run by user 'jboss' and JDK binaries are in /usr/local/jdk/bin.
            # All this can be changed in the script itself.
            #
            # Either modify this script for your requirements or just ensure that
            # the following variables are set correctly before calling the script.

            #define where jboss is - this is the directory containing directories log, bin, conf etc
            JBOSS_HOME=${JBOSS_HOME:-"/home/ceo/jboss-4.2.2.GA"}

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

            #make sure java is in your path
            JAVAPTH=${JAVAPTH:-"/usr/local/lib/jdk1.5.0_15/bin"}

            #configuration to use, usually one of 'minimal', 'default', 'all'
            JBOSS_CONF=${JBOSS_CONF:-"default"}

            #if JBOSS_HOST specified, use -b to bind jboss services to that address
            JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}


            #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 $JBOSS_CONF $JBOSS_BIND_ADDR"}

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

            if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
            # ensure the file exists
            touch $JBOSS_CONSOLE
            if [ ! -z "$SUBIT" ]; then
            chown $JBOSS_USER $JBOSS_CONSOLE
            fi
            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"}


            JBOSS_CMD_START="$JBOSSSH"
            JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown -s"}

            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 JBOSS_CMD_START = $JBOSS_CMD_START

            case "$1" in
            start)
            cd $JBOSS_HOME/bin
            if [ -z "$SUBIT" ]; then
            eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &
            else
            $SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &"

            fi
            ;;
            stop)
            if [ -z "$SUBIT" ]; then
            $JBOSS_CMD_STOP
            else
            $SUBIT "$JBOSS_CMD_STOP"
            fi
            ;;
            restart)
            $0 stop
            $0 start
            ;;
            *)
            echo "usage: $0 (start|stop|restart|help)"
            esac



            as for the server/xxx/log/server.log file, its empty

            • 3. Re: installing jboss AS 4.2 as a service in Debian lenny
              Peter Johnson Master

              First, let's make sure that the java running is what you think it is. Enter (as root):

              ps -C java -f > ps.out

              and post the contents of ps.out.

              Is there a server/default/log/boot.log file?

              • 4. Re: installing jboss AS 4.2 as a service in Debian lenny
                Phanor Coll Newbie

                this is the content of ps.out

                UID PID PPID C STIME TTY TIME CMD
                root 4239 4219 9 12:44 pts/0 00:01:04 java -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/usr/local/jboss-4.2.2.GA/lib/endorsed -classpath /usr/local/jboss-4.2.2.GA/bin/run.jar org.jboss.Main


                and when i start linux, it attempts to start jboss, but i get the following

                /etc/init.d/rc:line 78:/etc/rc2.d/S20jboss: Permission denied

                i created the jboss user, i set the permission of tje jbossAs folder to the jboss user, still doesnt work..

                • 5. Re: installing jboss AS 4.2 as a service in Debian lenny
                  Peter Johnson Master

                  With the process having run for over a minute, I would have expected to see either server.log or boot.log. Was the server/xxx/log directory created? If not, then there are still some permission issues, though from the script you posted earlier it should be running as root. It is, the ps confirms it.

                  • 6. Re: installing jboss AS 4.2 as a service in Debian lenny
                    Phanor Coll Newbie

                    its workiing.. i changed the JBOSS_USER variable in the init.d script from jboss to RUNASIS...

                    is there a problem if a leave it with RUNASIS??

                    and another question..do you know how to change o modify the default page of jboss, the one that loads http://localhost:8080



                    thanks a lot

                    • 7. Re: installing jboss AS 4.2 as a service in Debian lenny
                      Peter Johnson Master

                      What do you mean you changed it from jboss to RUNASIS? The script you posted has RUNASIS, not jboss, and the app server is running as root. Did you create a 'jboss' user account and make that account the owner of /usr/local/jboss-4.2.2.GA?

                      You really should not let the app server run as root, that leaves a nice big security hole.

                      Regarding the default page, see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=104203

                      • 8. Re: installing jboss AS 4.2 as a service in Debian lenny
                        Phanor Coll Newbie

                        sorry my mistake...
                        i created the user jboss with
                        #adduser jboss and enter the password for that user.

                        i made jboss the owner of /usr/local/jboss-4.2.2.GA with
                        #chown -R jboss:jboss jboss-4.2.2.GA

                        if a change from RUNASIS to jboss as the user, it wont start

                        • 9. Re: installing jboss AS 4.2 as a service in Debian lenny
                          Phanor Coll Newbie

                           

                          "phanor" wrote:
                          sorry my mistake...
                          i created the user jboss with
                          #adduser jboss and enter the password for that user.

                          i made jboss the owner of /usr/local/jboss-4.2.2.GA with
                          #chown -R jboss:jboss jboss-4.2.2.GA

                          if a change from RUNASIS to jboss as the user in the init.d script, it wont start