14 Replies Latest reply on Apr 6, 2006 1:03 PM by zwige01

    stopping Jboss

    ssandy

      does anyone know how i can stop Jboss. What is this stop.jar?

        • 1. Re: setting up nukes in Jboss/Eclipse IDE
          marc.fleury

          Hi, guys, have anybody tried the suggestions?

          referring to nick's steps, do I need to specify $JBOSS_NUKES to be my project directory? then I go to $JBOSS_NUKES/path-to-{common,nukes,other-modules} to place the .classpath?

          which .jar that I need? can you refer me to a web-site that show step-by-step how to write and deploy customized modules?

          I refer to the "onjava article"

          but it never showed the full source code (import statements, lib/jar files for the classpath) and the directory that I should deploy the module. do I need to explode nukes.ear and package it again?

          • 2. Re: stopping Jboss
            marc.fleury

            ctrl c is a hook into the shutdown of jboss

            • 3. Re: stopping Jboss
              ssandy

              I want to stop it from something similar to the start.bat

              • 4. Re: stopping Jboss
                khenneuse

                Look into stop.jar It is in jboss/client/ There is
                a class called org.jboss.jmx.client.Stop

                You will need to add a few other jar files to the
                Classpath to get it to work correctly but that will use
                the shutdown hook in JBoss.

                -Kent

                • 5. Re: stopping Jboss
                  dhruvar

                  I don't know how to write DOS batch files, but here is the shell script that I use for this purpose. I keep it in the 'bin' directory with 'run.sh'...

                  #!/bin/sh
                  #############################################################################
                  #
                  # Shuts down JBoss
                  #
                  #############################################################################
                  JBOSS_CLASSPATH=$JBOSS_CLASSPATH:../lib/ext/jboss.jar

                  java -classpath $JBOSS_CLASSPATH org.jboss.Shutdown $@

                  • 6. Re: stopping Jboss
                    jhaddad

                    I'm trying to stop jboss with the following command:
                    > java -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.url=jnp://localhost:1099 -jar jboss/client/stop.jar

                    After running this, I get the message 'Server has been successfully stopped.'
                    This appears to stop all jboss services as indicated by shutdown messages in the console. However, it hangs at the very end, leaving the jvm process running. The last line in the console is:
                    > The database is closed as Embbeded

                    Anyone else seeing this behavior? I'm trying to start/stop jboss from ant to automate junit testing. Doesn't work if I can't stop jboss.

                    • 7. Re: stopping Jboss
                      jannik1024

                      I did it this way:

                      rem Shuts down JBoss 3.2.3
                      
                      java -classpath shutdown.jar org.jboss.Shutdown $@
                      


                      With a bat file called end on winXP

                      • 8. Re: stopping Jboss
                        morales4

                        You can try this one. Just edit some line for your preference.

                        #!/bin/sh
                        #
                        # Start and stop jboss
                        #
                        case "$1" in
                         start)
                         proc=`ps -ef --cols 120 | grep infoload | grep run.sh | grep -v
                         grep | wc -l`
                         if [ $proc = 0 ] ; then
                         echo "Starting JBoss."
                         nohup /usr/local/jboss-3.0.6/bin/run.sh &
                         echo "JBoss started."
                         else
                         echo "JBoss already running."
                         fi
                         ;;
                         stop)
                         proc=`ps -ef --cols 120 | grep run.sh | grep -v grep | wc -l`
                         if [ $proc -ge 1 ]; then
                         echo "Stopping JBoss."
                         for x in `ps -ef --cols 120 |grep infoload | grep run.sh| grep -
                        v grep |awk '{print $2}'`
                         do
                         kill -9 $x
                         done
                         echo "JBoss stopped."
                         else
                         echo "JBoss already stopped."
                         fi
                         ;;
                        
                         restart)
                         echo "Restarting JBoss. Please wait."
                         for x in `ps -ef --cols 120 |grep infoload | grep run.sh | awk '
                        {print $2}'`
                         do
                         kill -9 $x
                         done
                         nohup /usr/local/jboss-3.0.6/bin/q2 &
                         echo "JBoss restarted."
                         ;;
                         *)
                         echo "Usage: jboss {start|stop|restart}"
                         exit 1
                        esac
                        
                        exit 0


                        • 9. Re: stopping Jboss
                          dannyyates

                          WHY WHY WHY do people insist on killing processes? They do it at here work and it causes all sorts of problems. There's a perfectly good shutdown mechanism which will ensure everything is shutdown cleanly. Try doing a kill -9 (or Windows equivalent) on the Eclipse IDE and see where that gets you next time you try and start it.

                          • 10. Re: stopping Jboss

                            The 1.4.2_02 VM on linux is fine. I use it with the correct shutdown.jar and have had no issues.

                            A "kill -9" is a last resort and should be treated as such.

                            • 11. Re: stopping Jboss
                              mlybarger

                              i'm after some recommended procedures for shutting down jboss. we're using win 2k, tao linux, and SuSE linux.

                              we currently aren't using init.d scripts on the linux machines. we're using an ant build script which calls the run.sh and shutdown.sh

                              here'sthe issue we're seeing. in order to recycle the servers (we have some classes that cache data from a db, and the way we flush the data is to recycle the server :) ), we first shutdown.sh then startup.sh. but shutdown.sh returns immediately, and the startup doesn't always go smoothly. i don't know the issues the startup has because we're using ant's spawn attribute to ensure the task is fired separately from the ant script process.

                              we're using jboss 4.0.0.

                              any thoughts on recycling a jboss server instance would be most appreciated.

                              • 12. Re: stopping Jboss
                                peterj

                                The most likely cause of the problems is that the instance of JBoss that is terminating still has ports opened that the instance of JBoss starting up is attempting to use. The simple, but possibly innacurate, solution is to put a wait in your ant script between running shutdown.sh and run.sh. The harder, but accurate, solution is to test the ports to make sure that they have been released by the JBoss instance that is terminating before running run.sh.

                                Hope this helps.

                                • 13. Re: stopping Jboss
                                  mlybarger

                                  we have coded a wait after the shutdown, but 10sec doesn't seem to be enough. the problem with checking the ports is that they can be configured on different environments. plus there's lots of ports being opened by jboss. which ones to check?

                                  isn't there a synchronous shutdown call for jboss that returns success/failure on shutdown?

                                  we've noticed when sending an OS sigsegv to the servers, that they have problems restarting. some classes not serializable on startup. are there inflight transactions or "cruft" that the server tries to revive after a forced shutdown?

                                  • 14. Re: stopping Jboss

                                    A solution that could work in your case: parallel Ant task. In parallel, do the following:
                                    - Start JBoss using the NOPAUSE option.
                                    - Wait for JBoss to start, do you work/tests, shutdown JBoss.

                                    GMZ