• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Start/stop applications using JBOSS API

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I would like to know if there is an API to start/stop an application (war/ear) in Jboss. I guess this can be done using Jboss JMX management API but I could not find any documentation. The requirement is not to undeploy/deploy the application, we just need to programatically check the status of an application and stop/start it.

Thanks,
Ram Charan
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look in the JMX Console, for an MBean like jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/XXX, where XXX is the WARs context. This MBean has a stop() operation which prevents the app from getting requests.
 
Ram Charan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter, Thanks. My app is deployed as an EAR and I found out stop() method is under jboss.j2ee, service=EARDeployment,url='MyApp.ear'. I could not find it under j2eeApplications MBean. Is this Mbean I mentioned correct?

Is there a way to programmatically invoke stop?

-Ram Charan
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that is the correct MBean (the example I posted was for a WAR not packaged in an EAR).

You can use the JMX API (package: javax.management) to invoke the stop operation on the MBean. The code should look something like this:

Context ctx = new InitialContext();
MBeanServerConnection mconn =(MBeanServerConnection)ctx.lookup("jmx/invokerRMIAdaptor");
ObjectName name = new ObjectName("<<your-mbean-name-here>>");
mconn.invoke(name, "stop", null, null);
reply
    Bookmark Topic Watch Topic
  • New Topic