Difference between revisions of "Jetty/Feature/JMX"

From Eclipsepedia

< Jetty‎ | Feature
Jump to: navigation, search
Line 12: Line 12:
 
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).  
 
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).  
  
See [[Jetty/Howto/Run_Jetty_with_JConsole]] for instructions on how to configure jmx for use with [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole].  
+
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  ==
 
== Jetty Standalone  ==
Line 26: Line 26:
 
== Jetty Maven Plugin  ==
 
== 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">
+
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 <jettyconfig> element to the plugin <configuration>: <source lang="xml">
 
<plugin>
 
<plugin>
 
   <groupid>org.mortbay.jetty</groupid>
 
   <groupid>org.mortbay.jetty</groupid>
Line 36: Line 36:
 
   </configuration>
 
   </configuration>
 
</plugin>
 
</plugin>
 
+
</source>
 
| more =
 
| more =
See [[Jetty/Howto/Run_Jetty_with_JConsole]] for instructions on how to configure jmx for use with Sun's [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole].
+
See [[Jetty/Howto/Run_Jetty_with_JConsole|Run Jetty with JConsole]] for instructions on how to configure jmx for use with Sun's [http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html JConsole].
 
| categories = [[Category:Jetty Feature]]
 
| categories = [[Category:Jetty Feature]]
 
}}
 
}}

Revision as of 21:13, 21 December 2009



Contents

Introduction

The Jetty 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 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.

Feature

Using Jetty MBeans

The simplest way to use Jetty MBeans is to use the JConsole utility supplied with Sun's Java Virtual Machine. An internal HTTP agent can also be used (see jetty-jmx.xml config file comments).

See Run Jetty with JConsole for instructions on how to configure jmx for use with 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:
java -jar start.jar etc/jetty-jmx.xml etc/jetty.xml
 
 
Jetty 7 requires -DOPTIONS=jmx to be used when starting up Jetty. That is, instead of the above, use this: <source lang="text">
java -DOPTIONS=jmx -jar start.jar etc/jetty-jmx.xml etc/jetty.xml
 
 
== 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 <jettyconfig> element to the plugin <configuration>: <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>

Additional Resources

See Run Jetty with JConsole for instructions on how to configure jmx for use with Sun's JConsole.