Hi,

Can any one suggest, how to find the jboss server status?

My application has a requirement to start the jboss server only if it is not already 
started. 

I am able to find the status, if the server is already running, by accessing the 
respective MBean ("jboss.system:type=Server" MBean has a read only attribute 
"Started"). 

Following is the code snippet I used.


  | InitialContext ic;
  | Properties jndiProperties;
  | RMIAdaptor server;
  | ObjectName name;
  | MBeanInfo info;
  | try {
  |     jndiProperties = new Properties();
  |     jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory" );
  |     jndiProperties.put(Context.PROVIDER_URL, "localhost:1099");
  |     ic = new InitialContext(jndiProperties);
  |     server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");
  |     name = new ObjectName("jboss.system:type=Server");
  |     boolean serverStatus;
  |     serverStatus = ((Boolean)server.getAttribute(name, "Started")).booleanValue();
  |     System.out.println("serverStatus="+serverStatus);
  | }   catch(Exception ex)
  | {
  |     ex.printSTackTrace();
  | }
  | 

By the way, Does Pinging 1099 port help in identifying the server status?

TIA

Maheedhar

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840852#3840852

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840852


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to