3

Is there a way to start, stop or restart applications running within tcserver using JMX or using a HTTP request? For example, in tomcat 6.0, the following can be done to start an application:

http://localhost:8080/manager/start?path=/examples

When I start the hyperic agent, I could not see any Mbeans defined for the agent process to start/stop a runtime instance within a tcserver.

Brian Clozel
  • 46,620
  • 12
  • 129
  • 152
Prasanna
  • 3,483
  • 7
  • 41
  • 71

1 Answers1

2

A Tomcat (and tcserver probably as well) registers a MBean for every WebModule which looks like

Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/jolokia

where the domain name and name property depend on your installation and the WebModule. Each of those MBeans has a start() and a stop() operation.

In case you are using a Jolokia agent, you can directly use an HTTP call like

  wget -O - -q
      http://localhost:8080/jolokia/exec/Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=/--/localhost/-/jolokia/start

(slashes needs to be escaped, single slash with /-/, double slash with /--/. See the Jolokia reference manual) for details.

Roland Huß
  • 2,397
  • 14
  • 27
  • I was not able to find any MBean specific to my runtime instance from jconsole. I do not understand two things: 1) I can access my tcserver runtime instance mbeans by connecting as remote process using a jmx url from the jconsole although everything is running in the same machine. 2) Now when my tcserver is down I thought I can start it using hyperic agent over JMX, even that seems to be not possible. – Prasanna Jul 21 '11 at 05:35
  • 1
    For jconsole, I dont know whether every MBean is available in all modes. For JSR-160 based communication (that is, connecting with a JMX service URL), they should be available, if you specify the proper MBeanServer in the URL. There can be more than one MBeanServer pro JVM (e.g. Weblogic uses at least 3). For the second point, you obviously can't start a JVM via JMX since JMX is only available when the JVM is running. I don't know whether an Hyperic agent can start a Java process, but if so, not via JMX. – Roland Huß Jul 21 '11 at 11:08
  • I found out that hyperic agent basically executes the startup script to start a runtime instance. So I guess that is the way to go to control any tcserver runtime instance. – Prasanna Jul 21 '11 at 18:36