Difference between revisions of "Jetty/Feature/JMX"

From Eclipsepedia

< Jetty‎ | Feature
Jump to: navigation, search
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Jetty Feature
 
{{Jetty Feature
 
| introduction =  
 
| introduction =  
The Java Management Extensions (JMX) API is a standard API for management and monitoring of resources such as applications, devices, services, and the Java virtual machine. The JMX technology was developed through the Java Community Process.
+
 
 +
{{Jetty Redirect|http://www.eclipse.org/jetty/documentation/current/jmx-chapter.html}}
 +
 
 +
[http://java.sun.com/products/JavaManagement/ Java Management Extensions] (JMX) API is a standard API for management and monitoring of resources such as applications, devices, services, and the Java virtual machine. The JMX technology was developed through the Java Community Process.
  
 
Typical uses of the JMX technology include:  
 
Typical uses of the JMX technology include:  
Line 9: Line 12:
  
 
The JMX API includes remote access, so a remote management program can interact with a running application for these purposes.  
 
The JMX API includes remote access, so a remote management program can interact with a running application for these purposes.  
 +
 
| body =  
 
| body =  
 +
Jetty JMX integration can be configured using etc/jetty-jmx.xml configuration file. See [[Jetty/Tutorial/JMX|Jetty JMX tutorial]] for instructions on how to configure Jetty JMX integration.
  
The Jetty [http://java.sun.com/products/JavaManagement/ JMX] integration is based on the ObjectMBean implementation of DynamicMBean. This implementation allows an arbitrary POJO to be wrapped in an MBean and for meta data to be provided by [http://dev.eclipse.org/viewcvs/index.cgi/jetty/trunk/jetty-jmx/src/main/resources/org/eclipse/jetty/?root=RT_Jetty properties files]
+
In order to monitor an application using JMX, the following steps have to be performed:
 +
# Application should instantiate an MBean container.
 +
# Objects have to be instrumented to be MBeans.
 +
# MBeans need to be accessed by JMX agents.
  
The creation of MBeans is coordinated by the MBeanContainer implementation of the Container.Listener interface. The Jetty Server and it's components use a [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/util/component/Container.html Container] to maintain a containment tree of components and to support notification of changes to that tree. The MBeanContainer class listens for Container events and creates and destroys MBeans as required to wrap all Jetty components.  
+
Jetty JMX integration uses platform MBean server implementation provided by Java VM. The integration is based on the ObjectMBean implementation of DynamicMBean. This implementation allows an arbitrary POJO to be wrapped in an MBean and for meta data to be provided by [http://dev.eclipse.org/viewcvs/index.cgi/jetty/trunk/jetty-jmx/src/main/resources/org/eclipse/jetty/?root=RT_Jetty properties files].  
  
=== Using Jetty MBeans ===
+
The creation of MBeans is coordinated by the MBeanContainer implementation of the Container.Listener interface. The Jetty Server and it's components use a [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/util/component/Container.html Container] to maintain a containment tree of components and to support notification of changes to that tree. The MBeanContainer class listens for Container events and creates and destroys MBeans as required to wrap all Jetty components.
  
The simplest way to use Jetty MBeans is to use the [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole] utility supplied with Sun's Java Virtual Machine. An internal HTTP agent can also be used (see jetty-jmx.xml config file comments).
+
MBeans published by Jetty can be accessed both through built-in Java VM connector via JConsole, or by registering a remote JMX connector and using a remote JMX agent to monitor Jetty.
 
+
See [[Jetty/Howto/Run Jetty_with_JConsole|Run Jetty with JConsole]] for instructions on how to configure jmx for use with [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole].
+
 
+
=== Jetty Standalone  ===
+
 
+
The MBeanContainer instance can be configured for a Jetty server by the jetty-jmx.xml configuration file. This can be run with the standard configuration file as follows:
+
 
+
<pre>
+
java -jar start.jar OPTIONS=Server,jmx etc/jetty-jmx.xml etc/jetty.xml
+
</pre>
+
 
   
 
   
 
=== Jetty Maven Plugin  ===
 
 
If you are using the [http://jetty.mortbay.org/maven-plugin/index.html Jetty Maven plugin] you should copy the etc/jetty-jmx.xml file into your webapp project somewhere, such as src/etc, then add a &lt;jettyconfig&gt; element to the plugin &lt;configuration&gt;:
 
 
<source lang="xml">
 
<plugin>
 
  <groupid>org.mortbay.jetty</groupid>
 
  <artifactid>maven-jetty-plugin</artifactid>
 
  <version>${project.version}</version>
 
  <configuration>
 
    <scanintervalseconds>10</scanintervalseconds>
 
    <jettyconfig>src/etc/jetty-jmx.xml</jettyconfig>
 
  </configuration>
 
</plugin>
 
</source>
 
 
 
| more =
 
| more =
See [[Jetty/Howto/Run_Jetty_with_JConsole|Run Jetty with JConsole]] for instructions on how to configure JVM for use with Sun's [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole].
+
* See [[Jetty/Tutorial/JMX|Jetty JMX tutorial]] for instructions on how to configure Jetty JMX integration.
 +
* The [http://code.google.com/p/jminix/ JMiniX] web consoles for JMX beans.
 
| categories = [[Category:Jetty Feature]]
 
| categories = [[Category:Jetty Feature]]
 
}}
 
}}

Latest revision as of 15:05, 26 April 2013



[edit] Introduction


Java Management Extensions (JMX) API is a standard API for management and monitoring of resources such as applications, devices, services, and the Java virtual machine. The JMX technology was developed through the Java Community Process.

Typical uses of the JMX technology include:

  • Consulting and changing application configuration.
  • Accumulating statistics about application behavior and making them available.
  • Notifying of state changes and erroneous conditions.

The JMX API includes remote access, so a remote management program can interact with a running application for these purposes.

[edit] Feature

Jetty JMX integration can be configured using etc/jetty-jmx.xml configuration file. See Jetty JMX tutorial for instructions on how to configure Jetty JMX integration.

In order to monitor an application using JMX, the following steps have to be performed:

  1. Application should instantiate an MBean container.
  2. Objects have to be instrumented to be MBeans.
  3. MBeans need to be accessed by JMX agents.

Jetty JMX integration uses platform MBean server implementation provided by Java VM. The integration is based on the ObjectMBean implementation of DynamicMBean. This implementation allows an arbitrary POJO to be wrapped in an MBean and for meta data to be provided by properties files.

The creation of MBeans is coordinated by the MBeanContainer implementation of the Container.Listener interface. The Jetty Server and it's components use a Container to maintain a containment tree of components and to support notification of changes to that tree. The MBeanContainer class listens for Container events and creates and destroys MBeans as required to wrap all Jetty components.

MBeans published by Jetty can be accessed both through built-in Java VM connector via JConsole, or by registering a remote JMX connector and using a remote JMX agent to monitor Jetty.

Additional Resources

  • See Jetty JMX tutorial for instructions on how to configure Jetty JMX integration.
  • The JMiniX web consoles for JMX beans.