blob: e7cb37b631920396b1b96424109637c3320341b8 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Managing Jetty with JConsole and JMC</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="jmx-chapter.html" title="Chapter&nbsp;14.&nbsp;Java Management Extensions (JMX)"><link rel="prev" href="jetty-jmx-annotations.html" title="Jetty JMX Annotations"><link rel="next" href="alpn-chapter.html" title="Chapter&nbsp;15.&nbsp;Application Layer Protocol Negotiation (ALPN)"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
hljs.initHighlightingOnLoad();
</script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
Version: 9.3.28.v20191105</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Managing Jetty with JConsole and JMC</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="jetty-jmx-annotations.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;14.&nbsp;Java Management Extensions (JMX)<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="alpn-chapter.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
<span class="website">www.webtide.com</span></a></h5><p>
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ...
scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="jetty-jconsole"></a>Managing Jetty with JConsole and JMC</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="jetty-jconsole.html#_starting_jetty_standalone">Starting Jetty Standalone</a></span></dt><dt><span class="section"><a href="jetty-jconsole.html#jetty-jconsole-monitoring">Monitoring Jetty with JConsole</a></span></dt><dt><span class="section"><a href="jetty-jconsole.html#_managing_jetty_objects_with_jconsole">Managing Jetty Objects with JConsole</a></span></dt><dt><span class="section"><a href="jetty-jconsole.html#jetty-jmc-monitoring">Monitoring Jetty with JMC</a></span></dt><dt><span class="section"><a href="jetty-jconsole.html#_managing_jetty_objects_with_jconsole_2">Managing Jetty Objects with JConsole</a></span></dt></dl></div><p>JConsole and the Java Mission Control (JMX) are graphical tools; they allow you to remotely manage and monitor your server and web application status using JMX.
When following the instructions given below, please also ensure that you make any necessary changes to any anti-virus software you may be using which may prevent JConsole or JMC from running.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_starting_jetty_standalone"></a>Starting Jetty Standalone</h3></div></div></div><p>The simplest way to enable support is to add the JMX-Remote support module to your <code class="literal">{$jetty.base}</code>.</p><div class="screenexample"><pre class="screen">[mybase]$ java /opt/jetty-dist/start.jar --add-to-start=jmx-remote, jmx
INFO: jmx-remote initialised in ${jetty.base}/start.ini
INFO: jmx initialised in ${jetty.base}/start.ini</pre></div><p>Then open the <code class="literal">{$jetty.base}/start.ini</code> (or <code class="literal">{$jetty.base}/start.d/jmx-remote.ini</code>) file and edit the properties to suit your needs:</p><div class="screenexample"><pre class="screen">#
# Initialize module jmx-remote
#
--module=jmx-remote
## JMX Configuration
## Enable for an open port accessible by remote machines
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-jconsole-monitoring"></a>Monitoring Jetty with JConsole</h3></div></div></div><p>To monitor Jetty&#8217;s server status with JConsole, start Jetty and then start JConsole by typing <code class="literal">jconsole</code> on the command line.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_connecting_to_your_server_process"></a>Connecting to your server process</h4></div></div></div><p>After you start Jetty, you will see a dialog box in JConsole with a list of running processes to which you can connect.
It should look something like so:</p><p><span class="inlinemediaobject"><img src="images/jconsole1.jpg" width="576" alt="image"></span></p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-plus" aria-hidden="true"></i> Important</h3><p>If you don&#8217;t see your Jetty process in the list of processes you can connect to, quickly switch tabs, or close and reopen a new "New Connection" dialog window.
This forces JConsole to refresh the list, and recognize your newly-started Jetty process.</p></div></blockquote></div><p>Select the start.jar entry and click the "Connect" button.
A new JConsole window opens:</p><p><span class="inlinemediaobject"><img src="images/jconsole2.jpg" width="576" alt="image"></span></p><p>From this window you can monitor memory usage, thread usage, classloading and VM statistics.
You can also perform operations such as a manual garbage collect.
JConsole is an extremely powerful and useful tool.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_managing_jetty_objects_with_jconsole"></a>Managing Jetty Objects with JConsole</h3></div></div></div><p>The MBean tab of JConsole allows access to managed objects within the Java application, including MBeans the JVM provides.
If you also want to interact with the Jetty JMX implementation via JConsole, you need to start Jetty JMX in a form that JConsole can access.
See <a class="xref" href="jmx-chapter.html#using-jmx" title="Using JMX with Jetty">Using JMX with Jetty</a> for more information.</p><p><span class="inlinemediaobject"><img src="images/jconsole3.png" width="576" alt="image"></span></p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-jmc-monitoring"></a>Monitoring Jetty with JMC</h3></div></div></div><p>To monitor Jetty&#8217;s server status with JMC, start Jetty and then start JMC by typing <code class="literal">jmc</code> on the command line.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_connecting_to_your_server_process_2"></a>Connecting to your server process</h4></div></div></div><p>After you start Jetty, you will see a dialog box in JMC with a list of running processes to which you can connect.
It should look something like so:</p><p><span class="inlinemediaobject"><img src="images/jmc1.png" width="576" alt="image"></span></p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-plus" aria-hidden="true"></i> Important</h3><p>If you don&#8217;t see your Jetty process in the list of processes you can connect to, quickly switch tabs, or close and reopen a new "New Connection" dialog window.
This forces JMC to refresh the list, and recognize your newly-started Jetty process.</p></div></blockquote></div><p>Double-click the start.jar entry or right-click the start.jar entry and select "Start JMX Console".
A new JMC window opens on the right:</p><p><span class="inlinemediaobject"><img src="images/jmc2.png" width="576" alt="image"></span></p><p>From this window you can monitor memory usage, thread usage, classloading and VM statistics.
You can also perform operations such as a manual garbage collect.
JMC is an extremely powerful and useful tool.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_managing_jetty_objects_with_jconsole_2"></a>Managing Jetty Objects with JConsole</h3></div></div></div><p>The MBean tab of JMC allows access to managed objects within the Java application, including MBeans the JVM provides.
If you also want to interact with the Jetty JMX implementation via JMC, you need to start Jetty JMX in a form that JMC can access.
See <a class="xref" href="jmx-chapter.html#using-jmx" title="Using JMX with Jetty">Using JMX with Jetty</a> for more information.</p><p><span class="inlinemediaobject"><img src="images/jmc3.png" width="576" alt="image"></span></p></div></div><script type="text/javascript">
SyntaxHighlighter.all()
</script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="jetty-jmx-annotations.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="jmx-chapter.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="alpn-chapter.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Jetty JMX Annotations&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;15.&nbsp;Application Layer Protocol Negotiation (ALPN)</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
See an error or something missing?
<span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
<span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2019-11-05)</i></span></div></p></body></html>