2 Replies Latest reply on Aug 12, 2004 7:22 AM by jrw

    Server shutdown on errored startup

    jrw

      I have startup code in an MBean that attempts to connect to a MySQL database. If that connection to the database fails I would like to terminate the JBoss server. There is no point in running our app if the database is not available.

      I have tried calling System.exit(0) from my MBean. This causes the JBoss shutdown to start, but then the server hangs to the point where it will not respond to a CTRL-C. A Runtime.halt(0) does work, but I need a more gracefull shutdown.

      I do not believe the typical remote shutdown will work for us since we are using a stripped down version of JBoss.

      I am using JBoss version 3.2.3 on Windows XP.

      Any ideas?

      Thanks,

      Jamie

        • 1. Re: Server shutdown on errored startup

          Jamie;

          You can call the shutdown method in the MBean jboss.system:type=Server.

          //Nicholas

          • 2. Re: Server shutdown on errored startup
            jrw

            When calling shutdown via JMX I get the error java.lang.IllegalStateException: not started.

            Is there a fatal exception I can call which will cause the JBoss startup to fail?

            Any other ideas?

            Jamie

            ------------------------------------------------------------------

            06:31:12,765 ERROR [STDERR] RuntimeMBeanException: RuntimeException in MBean operation 'shutdown()'
            Cause: java.lang.IllegalStateException: not started
            06:31:12,765 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:299)
            06:31:12,781 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)