I need to check the runtime state of an application
server (weblogic 7.0) from inside a message driven
bean. I have created a utility class for this purpose.
When I invoke this class from an MDB, I always get the
state of Running even if the server is being shutdown
gracefully.
Here is the code:
...
Context ctx = new InitialContext();
System.out.println("Entered startup");
//Getting the Administration MBeanHome.
MBeanHome home = (MBeanHome)
ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
Iterator serverMBeansItr =
((Set)home.getMBeansByType("Server")).iterator();
String serverName = ((ServerMBean)
serverMBeansItr.next()).getName();
System.out.println("Server Name : " +
serverName);
WebLogicObjectName mbeanName = new
WebLogicObjectName(serverName, "ServerRuntime",
home.getDomainName(),serverName);
ServerRuntimeMBean serverRuntimeMBean =
(ServerRuntimeMBean) home.getMBean(mbeanName);
return serverRuntimeMBean.getState();
...
Any ideas.
Thanks
Sailesh
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|