users
[Top] [All Lists]

Getting App Server Runtime State Info

To: users@xxxxxxxxxx
Subject: Getting App Server Runtime State Info
From: Sailesh Rao <sailprao@xxxxxxxxx>
Date: Tue, 8 Jun 2004 12:58:37 -0700 (PDT)
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
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 

<Prev in Thread] Current Thread [Next in Thread>
  • Getting App Server Runtime State Info, Sailesh Rao <=