How to Run Jetty with jconsole
All you need do is start jconsole and then start jetty with a special system property:
If you are running the jetty maven plugin, then you need to start it like so:
You should see a dialog like so (Note that with the jetty maven plugin, there entry will say "org.codehaus.classworlds.Launcher "jetty:run"" instead):
Select the start.jar entry and click on the
Connect button.A new jconsole window will open:
From this window you will be able to monitor memory usage, thread usage, classloading and vm statistics. You'll also be able to perform operations such as doing a manual garbage collect. Jconsole is an extremely powerful and useful tool.
Using the Jetty mbeans with jconsole
If you also want to be able to interact with the Jetty JMX implementation via jconsole, then you need to start jetty JMX in a form that jconsole can access. To do this, you can use the builtin java 5 JMX server with:
Alternately, you can use the
etc/jetty-jmx.xml (soon to be called jetty-jmx-mx4j.xml)
file to use MX4J, but you need to have uncoment the remote connector:
Then, you will need to ensure that you have the
rmiregistry running. The start sequence becomes:
You then need to configure jconsole to find this remote connector. Click on the
Advanced panel and enter the connector url like so:
Connect button and you will be able to manipulate the Jetty mbeans.
Jetty Maven Plugin
To be able to manipulate the jetty mbeans with jconsole, you do the same as above, but providing the contents of the
etc/jetty-jmx.xml to the plugin as a <jettyConfig> element. See the Configuring JMX wiki page for instructions on how to do that.