Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8b4f49fa6286e8ec68df4fe6b1636ee473a13007 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- ============================================================================ -->
<!-- To correctly start Jetty with JMX module enabled, this configuration         -->
<!-- file must appear first in the list of the configuration files.               -->
<!-- The simplest way to achieve this is to add etc/jetty-jmx.xml as the          -->
<!-- first file in configuration file list at the end of start.ini file.          -->
<!-- ============================================================================ -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <!-- =========================================================== -->
  <!-- Initialize an mbean server                                  -->
  <!-- =========================================================== -->
  <Call id="MBeanServer" class="java.lang.management.ManagementFactory"
    name="getPlatformMBeanServer" />

  <!-- =========================================================== -->
  <!-- Initialize the Jetty MBean container                        -->
  <!-- =========================================================== -->
  <New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
    <Arg>
      <Ref id="MBeanServer" />
    </Arg>
  </New>

  <!-- Add to the Server to listen for object events -->
  <Get id="Container" name="container">
    <Call name="addEventListener">
      <Arg>
        <Ref id="MBeanContainer" />
      </Arg>
    </Call>
  </Get>

  <!-- Add to the Server as a lifecycle -->
  <!-- Only do this if you know you will only have a single jetty server -->
  <Call name="addBean">
    <Arg>
      <Ref id="MBeanContainer" />
    </Arg>
  </Call>

  <!-- Add the static log -->
  <Get id="Logger" class="org.eclipse.jetty.util.log.Log" name="log" />
  <Ref id="MBeanContainer">
    <Call name="addBean">
      <Arg>
        <Ref id="Logger" />
      </Arg>
    </Call>
  </Ref>
  
  <!-- In order to connect to the JMX server remotely from a different
       process, possibly running on a different host, Jetty JMX module
       can create a remote JMX connector.       
   -->

 
  <!-- Optionally add a remote JMX connector. The parameters of the constructor
       below specify the JMX service URL, and the object name string for the
       connector server bean. The parameters of the JMXServiceURL constructor 
       specify the protocol that clients will use to connect to the remote JMX
       connector (RMI), the hostname of the server (local hostname), port number
       (automatically assigned), and the URL path. Note that URL path contains
       the RMI registry hostname and port number, that may need to be modified
       in order to comply with the firewall requirements. 
  -->
  <New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
    <Arg>
      <New class="javax.management.remote.JMXServiceURL">
        <Arg type="java.lang.String">rmi</Arg>
        <Arg type="java.lang.String" />
        <Arg type="java.lang.Integer">0</Arg>
        <Arg type="java.lang.String">/jndi/rmi://localhost:0/jettyjmx</Arg>
      </New>
    </Arg>
    <Arg>org.eclipse.jetty:name=rmiconnectorserver</Arg>
    <Call name="start" />
  </New>
</Configure>

Back to the top