3 Replies Latest reply on Mar 4, 2002 3:16 PM by amalter

    Using the JBoss shutdown mbean

    pibakic

      Is there any way I can call the shutdown hook from an external application?

      Any help (w/ code if possible please) appreciated,

      Pib.

        • 1. Re: Using the JBoss shutdown mbean
          seven

          Try http://host_with_jboss:8082. There u'll find a mbean type=Shutdown. Go further in that page and u'll find a button named "shutdown". If u press that button, the browser will call the following URL (using GET method): http://host_with_jboss:8082/InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown. So if u can make this URL call using any other software u are done.

          • 2. Re: Using the JBoss shutdown mbean
            schaefera

            You can also use the org.jboss.Shutdown class. This unix script will to the shutdown w/o exposing the HTML-Adaptor which is a little bit risky.

            ----------------- Start.sh -------------------------
            #!/bin/sh

            cd /opt/jboss/jboss-2.2/bin

            PATH=/usr/lib/java2/bin:$PATH

            # Minimal jar file to get JBoss stopped
            CLASSPATH=$CLASSPATH:../lib/ext/jboss.jar

            # Add all login modules for JAAS-based security
            # and all libraries that are used by them here
            CLASSPATH=$CLASSPATH

            echo CLASSPATH=$CLASSPATH

            java -cp $CLASSPATH org.jboss.Shutdown $@

            --------------- End of Start.sh -------------------

            Have fun - Andy

            • 3. Re: Using the JBoss shutdown mbean
              amalter

              Who the heck uses the JMX html adapter in a production environment?

              Is it just me or does it seem crazy even to have this thing running. Do you guys trust your firewall enough to expose that much system functionality over a unauthenticated http port?

              I was thinking about creating a shutdown service behind our own (trusted) authentication logic. Should I try to get a handle to the actual ShutdownMBean and call shutdown() or just do a System.exit(0); (Which is all the shutdown MBean does anyway)