Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.mbeans
Class JMXAdaptorLifecycleListener

    java.lang.Object
      org.apache.catalina.mbeans.JMXAdaptorLifecycleListener

All Implemented Interfaces:
  LifecycleListener

public class JMXAdaptorLifecycleListener
extends java.lang.Object
implements LifecycleListener

Start JSR160 JMX Adapter with naming and jmx port! Add only as Server Listner to your tomcat server.xml

     <Server ...>
     ...
       <Listener className="org.apache.catalina.mbeans.JMXAdaptorLifecycleListener"

                 namingPort="8083" port="8084" host="myhost" />
     ...
     </Server>

You can use normal jmx system properties from command line or jmx config file:

- `-Dcom.sun.management.jmxremote.authenticate=true`
- `-Dcom.sun.management.jmxremote.ssl=false`
- `-Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/access.file`
- `-Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/password.file`
- `-Dcom.sun.management.config.file=$CATALINA_BASE/conf/jmx.properties`

Then run jconsole with: `jconsole service:jmx:rmi://myhost:8084/jndi/rmi://myhost:8083/server`

It would be be better if this was built into Tomcat as a configuration option, rather than having to do it as part of every Tomcat instance.

Origanal code idea comes from George Lindholm read Tomcat Bug 39055 and other helpful links are:

- Using Web Apps
- JVM 1.5 JMX Guide

Author:
  Peter Rossbach, Juergen Herrmann

Constructor Summary
`JMXAdaptorLifecycleListener()` create new jmx adaptor and read properties from file.

Method Summary
`protected java.lang.String` | `getConfigProperty(java.lang.String name)` get jmx config parameter from jmx config file or system property.
`java.lang.String` | `getHost()`
`java.lang.String` | `getInfo()` Return descriptive information about this Listener implementation and the corresponding version number, in the format `<description>/<version>`.
`java.lang.String` | `getJmxUrl()`
`int` | `getNamingPort()`
`int` | `getPort()`
`boolean` | `isEnabled()`
`void` | `lifecycleEvent(LifecycleEvent event)` Acknowledge the occurrence of the specified event.
`void` | `setEnabled(boolean enabled)`
`void` | `setHost(java.lang.String host)`
`void` | `setNamingPort(int namingPort)`
`void` | `setPort(int port)`
`void` | `start()` Start JMX connector and local name registry
`protected void` | `stop()` stop jmx connector at tomcat normale shutdown

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JMXAdaptorLifecycleListener

    public JMXAdaptorLifecycleListener()

  create new jmx adaptor and read properties from file. Use jvm property `-Dcom.sun.management.config.file=xxx` as file.

Method Detail

### getHost

    public java.lang.String getHost()

  Returns:
    Returns the host.

### setHost

    public void setHost(java.lang.String host)

### getPort

    public int getPort()

  Returns:
    Returns the port.

### setPort

    public void setPort(int port)

  Parameters:
    `port` - The port to set.

### getNamingPort

    public int getNamingPort()

  Returns:
    Returns the namingPort.

### setNamingPort

    public void setNamingPort(int namingPort)

  Parameters:
    `namingPort` - The namingPort to set.

### isEnabled

    public boolean isEnabled()

  Returns:
    Returns the enabled.

### setEnabled

    public void setEnabled(boolean enabled)

  Parameters:
    `enabled` - The enabled to set.

### getJmxUrl

    public java.lang.String getJmxUrl()

  Returns:
    the jmxUrl

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this Listener implementation and the corresponding version number, in the format `<description>/<version>`.

### lifecycleEvent

    public void lifecycleEvent(LifecycleEvent event)

  Description copied from interface: `LifecycleListener`
  Acknowledge the occurrence of the specified event.

  Specified by:
    `lifecycleEvent` in interface `LifecycleListener`
  Parameters:
    `event` - LifecycleEvent that has occurred

### stop

    protected void stop()

  stop jmx connector at tomcat normale shutdown

### getConfigProperty

    protected java.lang.String getConfigProperty(java.lang.String name)

  get jmx config parameter from jmx config file or system property.

  Parameters:
    `name` -
  Returns:
    config parameter value

### start

    public void start()

  Start JMX connector and local name registry

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.