Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[NEXUS-4782] Add jetty-jmx jar + example configuration #216

Merged
merged 4 commits into from

7 participants

@jdillon
Owner

Adds the jetty-jmx jar + examples/jetty-jmx.xml to the bundle

@velo

+1

@cstamas
Owner

:cake:

@adreghiciu
Owner

+1

@mcculls
Owner

+1

@rseddon
Owner

-1

The jetty-jmx.xml file is missing configuration information for Nexus. This is inconsistent with the other files in the examples directory.

@jdillon
Owner

I was not sure how these files were intended to be used, easy to update however. But IMO this is a bit strange, since if you need any 2 of these features, you are screwed for this "copy to jetty.xml" to install. The default jetty server's behavior to allow loading 1 or more xml files is much better.

@peterlynch
Owner

since this does not start a RMI connector server, why not just add this to the default jetty.xml?

@rseddon
Owner

+1
looks good now

@jdillon jdillon merged commit e478ad1 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 22, 2012
  1. @jdillon
Commits on Jan 23, 2012
  1. @jdillon
  2. @jdillon
  3. @jdillon

    Enable the remoting support

    jdillon authored
This page is out of date. Refresh to see the latest.
View
5 nexus/nexus-oss-webapp/pom.xml
@@ -130,6 +130,11 @@
<artifactId>jetty-rewrite</artifactId>
<version>${jetty.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jmx</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
<!--
<dependency>
<groupId>org.eclipse.jetty</groupId>
View
152 nexus/nexus-oss-webapp/src/main/resources/content/conf/examples/jetty-jmx.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+<!--
+
+ Copyright (c) 2008-2011 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions
+
+ This program is free software: you can redistribute it and/or modify it only under the terms of the GNU Affero General
+ Public License Version 3 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License Version 3
+ for more details.
+
+ You should have received a copy of the GNU Affero General Public License Version 3 along with this program. If not, see
+ http://www.gnu.org/licenses.
+
+ Sonatype Nexus (TM) Open Source Version is available from Sonatype, Inc. Sonatype and Sonatype Nexus are trademarks of
+ Sonatype, Inc. Apache Maven is a trademark of the Apache Foundation. M2Eclipse is a trademark of the Eclipse Foundation.
+ All other trademarks are the property of their respective owners.
+
+-->
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<!-- ============================================================ -->
+<!-- -->
+<!-- NOTE: Copy this file to ../jetty.xml to use it. -->
+<!-- -->
+<!-- For help using this configuration, see: -->
+<!-- -->
+<!-- https://docs.sonatype.com/display/NX/Jetty+Configuration -->
+<!-- -->
+<!-- ============================================================ -->
+<Configure id="Server" class="org.eclipse.jetty.server.Server">
+ <Call name="addConnector">
+ <Arg>
+ <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <Set name="host">${application-host}</Set>
+ <Set name="port">${application-port}</Set>
+ </New>
+ </Arg>
+ </Call>
+
+ <Set name="handler">
+ <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
+ <!-- The following configuration is REQUIRED, and MUST BE FIRST.
+ It makes the Plexus container available for use in the Nexus webapp. -->
+ <Call name="addLifeCycleListener">
+ <Arg>
+ <New class="org.sonatype.plexus.jetty.custom.InjectExistingPlexusListener"/>
+ </Arg>
+ </Call>
+
+ <!-- The following configuration disables JSP taglib support, the validation of which
+ slows down Jetty's startup significantly. -->
+ <Call name="addLifeCycleListener">
+ <Arg>
+ <New class="org.sonatype.plexus.jetty.custom.DisableTagLibsListener"/>
+ </Arg>
+ </Call>
+ </New>
+ </Set>
+
+ <New id="NexusWebAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
+ <Arg>
+ <Ref id="Contexts"/>
+ </Arg>
+ <Arg>${nexus-webapp}</Arg>
+ <Arg>${nexus-webapp-context-path}</Arg>
+ <Set name="extractWAR">false</Set>
+ </New>
+
+ <Set name="stopAtShutdown">true</Set>
+ <Set name="sendServerVersion">true</Set>
+ <Set name="sendDateHeader">true</Set>
+ <Set name="gracefulShutdown">1000</Set>
+
+ <!-- ================= -->
+ <!-- JMX Configuration -->
+ <!-- ================= -->
+
+ <Call id="MBeanServer" class="java.lang.management.ManagementFactory" name="getPlatformMBeanServer"/>
+
+ <New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
+ <Arg>
+ <Ref id="MBeanServer"/>
+ </Arg>
+ </New>
+
+ <Get id="Container" name="container">
+ <Call name="addEventListener">
+ <Arg>
+ <Ref id="MBeanContainer"/>
+ </Arg>
+ </Call>
+ </Get>
+
+ <Call name="addBean">
+ <Arg>
+ <Ref id="MBeanContainer"/>
+ </Arg>
+ </Call>
+
+ <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. It requires RMI registry to
+ be started prior to creating the connector server because the
+ JMX specification uses RMI to facilitate connections.
+ -->
+
+ <!-- Optionally start the RMI registry. Normally RMI registry runs on
+ port 1099. The argument below can be changed in order to comply
+ with the firewall requirements.
+ -->
+ <Call name="createRegistry" class="java.rmi.registry.LocateRegistry">
+ <Arg type="java.lang.Integer">1099</Arg>
+ <Call name="sleep" class="java.lang.Thread">
+ <Arg type="java.lang.Integer">1000</Arg>
+ </Call>
+ </Call>
+
+ <!-- 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:1099/jmxrmi</Arg>
+ </New>
+ </Arg>
+ <Arg>org.eclipse.jetty:name=rmiconnectorserver</Arg>
+ <Call name="start"/>
+ </New>
+
+</Configure>
Something went wrong with that request. Please try again.