0 Replies Latest reply on Jun 1, 2005 3:52 AM by saroj sivakumar

    Gracefully stopping JBoss server when exception or error occ

    saroj sivakumar Newbie

      Hi,

      I have written startup class using MBean such that whenever an exception occurs the server has to stop gracefully.This is the part of code

      try{

      MBeanServer server = MBeanServerLocator.locateJBoss();

      ObjectName target = new ObjectName("jboss.system:type=Server");

      server.invoke(target,"shutdown",new Object[0],new String[0]);

      }
      catch (MBeanException e)
      {
      System.out.println("MBeanException");
      }
      catch (RuntimeMBeanException e)
      {
      System.out.println(" RuntimeMBeanException");
      }
      catch (Exception e)
      {
      System.out.println(" exception");
      }
      }

      This is working fine when an exception occurs when the server is already started.But when an exception occurs while starting the server for first time it throws RuntimeMBeanException.y is it so.

      Can anyone help me.


      Regards,
      sivaku.