8 Replies Latest reply on Dec 14, 2010 11:49 AM by greyfairer2

    Check the correctness of jbossesb.spec and jbossesb.init

    ingedeut

      Hello,

       

      i am trying to build an AMI for JBossESB 4.8 with JBossAS 4.2.3.GA. Therfore i need an RPM for JBossESB which will be included as Package in jbossesb.appl. So i have tried to build an RPM for jbossesb like Gatein.

      I use two files : jbossesb.spec and jbossesb.init and naturally JBoss-4.2.3.GA.tar.gz.

      The i have build the RPM for jbossesb using rpmbuild -ba jbossesb.spec.

      But i don't know if the above writed files are corrected or not and i don't know how to test if the RPM work correctly or not.

      Can somone please check the correctness of these two files?

       

      Thank you

       

       

      regards

       

      Younes

        • 1. Re: Check the correctness of jbossesb.spec and jbossesb.init
          goldmann

          Spec file looks pretty good.

           

          You need to build it and test it - there is no other way to be sure if the package is ok. Install it on vm or somewhere and execute start/stop methods for esb init script. This will show you if everything works.

           

          --Marek

          • 2. Re: Check the correctness of jbossesb.spec and jbossesb.init
            ingedeut

            Thanks Marek,

             

            What do you mean with vm please ? is this VMare?

             

            how to execute start/stop methods? With which command?

             

            Thanks

             

            Younes

            • 3. Re: Check the correctness of jbossesb.spec and jbossesb.init
              goldmann

              Virtual machine.

               

              service jboss-esb start or /etc/init.d/jboss-esb start

               

              --Marek

              • 4. Re: Check the correctness of jbossesb.spec and jbossesb.init
                ingedeut

                Thanks Marek,

                 

                i have test the RPM in a VMWare Virtuelle Machine and it works fine, but when installing it in an EC2 AMI the following issue is appeared:

                 

                JBoss ESB comes with its own jUDDI Registry which will be need to register the EPR (EndPointReference) of each registred service. The problem is when starting JBoss AS, the EPR of service are added to the database associated with jUDDI but when shutting down the EC2 Instance in which the AMI runs, the EPR still existing in the database which is wrong.

                These problem are not occured when testing with VMWare Virtuelle Machine. (EPR added normally when startin JBoss AS and then deleted normally when shutting down the service).

                 

                Can you please help me? Do you have any idea?

                 

                Thanks

                 

                younes

                • 5. Re: Check the correctness of jbossesb.spec and jbossesb.init
                  goldmann

                  Most probably your init script is not shutting down JBoss AS properly and AWS kills it. Check console log – maybe there you'll find some pointers.

                   

                  --Marek

                  • 6. Re: Check the correctness of jbossesb.spec and jbossesb.init
                    ingedeut

                    Thanks Marek,

                     

                    the stop function is like this:

                     

                     

                    stop() {
                        echo -n $"Stopping ${NAME}: "
                        pid=0
                        procrunning
                        if [ $pid = '0' ]; then
                    failure $"${NAME} shutdown"
                            echo -n -e "\nNo JBossas is currently running\n"
                            if [ -f $JBOSSLOCK ]; then
                    rm -f $JBOSSLOCK
                            fi
                    if [ -f $JBOSSPID ]; then
                    rm -f $JBOSSPID
                            fi
                    return 1
                        fi
                    
                    pid=0
                        RETVAL=1
                        procrunning
                    
                        # If process is still running
                    
                        # First, try to kill it nicely
                        if [ $RETVAL != 0 ] ; then
                    for id in `ps --ppid $pid | awk '{print $1}' | grep -v "^PID$"`; do
                               $SUBIT "kill -15 $id" 2>/dev/null
                            done
                    sleep=0
                            while [ $sleep -lt $JBOSS_STOP_TIMEOUT -a $RETVAL -eq 1 ]; do
                    sleep 5
                                sleep=`expr $sleep + 5`
                                pid=0
                                procrunning
                                if [ $pid == '0' ]; then
                    RETVAL=0
                                fi
                    done
                    fi
                    
                        # Still not dead... notify user
                    
                        count=0
                        pid=0
                        procrunning
                    
                        if [ $pid != '0' ] ; then
                    jboss_java_pid=`ps --ppid $pid | grep java | awk '{print $1}'`
                            echo -e "\nTimeout: Shutdown command was sent, but process is still running with PID $jboss_java_pid"
                            failure $"${NAME} shutdown"
                        else
                    rm -f /var/lock/subsys/${NAME}
                            if [ -r /etc/rc.d/init.d/functions ]; then
                    success $"${NAME} shutdown"
                            fi
                    fi
                    
                    echo
                        [ $RETVAL -eq 0 ] && rm -f $JBOSSLOCK $JBOSSPID
                        return $RETVAL
                    }
                    

                    $JBOSSLOCK
                            fi
                    if [ -f $JBOSSPID ]; then
                    rm -f $JBOSSPID
                            fi
                    return 1
                        fi
                    pid=0
                        RETVAL=1
                        procrunning
                        # If process is still running
                        # First, try to kill it nicely
                        if [ $RETVAL != 0 ] ; then
                    for id in `ps --ppid $pid | awk '{print $1}' | grep -v "^PID$"`; do
                               $SUBIT "kill -15 $id" 2>/dev/null
                            done
                    sleep=0
                            while [ $sleep -lt $JBOSS_STOP_TIMEOUT -a $RETVAL -eq 1 ]; do
                    sleep 5
                                sleep=`expr $sleep + 5`
                                pid=0
                                procrunning
                                if [ $pid == '0' ]; then
                    RETVAL=0
                                fi
                    done
                    fi
                        # Still not dead... notify user
                        count=0
                        pid=0
                        procrunning
                        if [ $pid != '0' ] ; then
                    jboss_java_pid=`ps --ppid $pid | grep java | awk '{print $1}'`
                            echo -e "\nTimeout: Shutdown command was sent, but process is still running with PID $jboss_java_pid"
                            failure $"${NAME} shutdown"
                        else
                    rm -f /var/lock/subsys/${NAME}
                            if [ -r /etc/rc.d/init.d/functions ]; then
                    success $"${NAME} shutdown"
                            fi
                    fi
                    echo
                        [ $RETVAL -eq 0 ] && rm -f $JBOSSLOCK $JBOSSPID
                        return $RETVAL
                    }

                     

                     

                    when shtting down this Info is shown:

                     

                     

                    13:51:29,299 INFO  [Server] Runtime shutdown hook called, forceHalt: true
                    13:51:29,305 INFO  [Server] JBoss SHUTDOWN: Undeploying all packages
                    

                     

                    can you please check the jbossesb.init and jbossesb.spec. I can't find the error causing this problem.

                     

                    --regards

                     

                    younes

                    • 7. Re: Check the correctness of jbossesb.spec and jbossesb.init
                      ingedeut

                      Hello Marek,

                       

                      i have used the same .init like this for jboss-as6.init using in CirrAS, but i still have the same problem when shutting down the JBoss AS server, the EPR are not deleting from the juddidb. When testing the same jbossesb.rpm with VMware Machine it works without error (EPR are deleting form database when shutting down the JBoss AS). Is there any additional Package that must be added to the jbossesb.appl file? Please help me . It's urgent!

                       

                      Thanks in advance

                       

                      --Regards

                       

                      Younes

                      • 8. Re: Check the correctness of jbossesb.spec and jbossesb.init
                        greyfairer2

                        Hi Younes,

                         

                        You might want to call the shutdown.sh script to shut down, before you try to kill -15.

                         

                        In the JBoss-RPM Google Code project, there is a 'stop' and a 'force-stop' command.

                        The force-stop goes for the kill, but the normal stop calls the Shutdown class, like the shutdown.sh script.

                        See e.g. http://code.google.com/p/jboss-rpm/source/browse/#svn/trunk/src/main/etc/init.d