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
MBeanServer server = MBeanServerLocator.locateJBoss();
ObjectName target = new ObjectName("jboss.system:type=Server");
server.invoke(target,"shutdown",new Object,new String);
catch (MBeanException e)
catch (RuntimeMBeanException e)
catch (Exception e)
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.