Configuring Nexus Repository 2 for JMX connections


Local and Remote JMX Connections

There are two ways to connect to Nexus using JMX - locally and remotely.

Local connections are possible without any extra configuration as long as the following conditions are met:

  • VisualVM and Nexus are running as the same user id
  • VisualVM and Nexus use the exact same Java version and architecture: Example 64 bit Java 7 for both.

Remote connections require explicit configuration changes.

Locally Connecting with VisualVM on Windows

Nexus usually runs as a Windows Service. Connecting to a Windows service using a local VisualVM install is particularly challenging. Here are some resources to help:

Monitoring Java Processes Running As a Windows Service

Configure JMX in the Standard Nexus Bundle zip/tar.gz

Below are steps for Nexus Repository versions 2.8 and higher.

1. Add the following property to NEXUS_HOME/bin/jsw/conf/wrapper.conf

Adjust the sequence number (shown here as "3") to be in line with the other lines.

2. Add the following properties to NEXUS_HOME/conf/


Ensure that a remotely accessible IP address is set for jmx-host to allow remote jmx access. It is important to ensure that the port is not blocked by any network setup, when connecting remotely. The value of 1099 is the default port used for JMX, but any other available port can be used as well.

3. Restart Nexus.

Below are steps for Nexus versions older than 2.8

Newer versions of Nexus have a <installation_dir>/conf/examples/jetty-jmx.xml file which can be used to configure JMX. Simply copy the differences from jetty-jmx.xml into <installation_dir>/conf/jetty.xml while nexus is stopped.

Note: If you want to be able to connect to JMX from a remote host you will need to add this line to  <nexus_root>/bin/jsw/conf/wrapper.conf:<hostname-or-ip-address>

Adjust the sequence number (shown here as "4") to be in line with the other lines.

Tip: To enable Mbeans for the JSW watchdog process add the following line to the wrapper.conf file:

Configure JMX with the Nexus Professional Trial Installer

The trial installation uses an Install4j installer and not Java Service Wrapper, therefore configuring JMX via JVM properties is slightly different from the regular bundles.

Find the Nexus installation directory. An easy way to do this is using the Nexus Control application - look for the "Installation" directory. 

Edit the "<installation_directory>/bin/nexus.vmoptions" file and add the following lines:

Restart nexus for the settings to take effect.

Important: For ease of use, we turn off the requirement to authenticate or use SSL when making the connection. Understand that some environments may treat this as a security risk. Since the aim of these instructions are to get you going as quickly as possible, we turn these options off here.

Important: Choose a port that is not already in use and can be accessed through firewalls. Ask your IT staff for guidance.

Remotely Connecting with VisualVM

Download Visual VM or launch jvisualvm from your JDK's bin directory. Click on "add jmx connection", and enter the IP address of the nexus host and the port you configured above. Example: ""


Failed to start Port already in use: 1099

Startup of Nexus Repo 2 may fail with a message like this is in the wrapper.log/nexus.log:

WARN  [WrapperListener_start_runner]  org.eclipse.jetty.xml.XmlConfiguration - Config error at <Call name="start"/>
WARN  [WrapperListener_start_runner]  org.eclipse.jetty.xml.XmlConfiguration - Config error at <New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer"><Arg>
      <New class=""><Arg type="java.lang.String">rmi</Arg><Arg type="java.lang.String"><Property name="jmx-host" default=""/></Arg><Arg type="java.lang.Integer"><Property name="jmx-port" default="1099"/></Arg><Arg type="java.lang.String">/jndi/rmi://<Property name="jmx-host" default=""/>:<Property name="jmx-port" default="1099"/>/jmxrmi</Arg></New>
    </Arg><Arg>org.eclipse.jetty:name=rmiconnectorserver</Arg><Call name="start"/></New>
ERROR [WrapperListener_start_runner] - Start failed
java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.invokeMethod(
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.invokeMethod(
	at org.eclipse.jetty.xml.XmlConfiguration$
	at org.eclipse.jetty.xml.XmlConfiguration$
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(
	at org.eclipse.jetty.xml.XmlConfiguration.configure(
	at Method)
	at org.tanukisoftware.wrapper.WrapperManager$
Caused by: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: Address already in use (Bind failed)
	at sun.rmi.transport.tcp.TCPTransport.listen(
	at sun.rmi.transport.tcp.TCPTransport.exportObject(
	at sun.rmi.transport.tcp.TCPEndpoint.exportObject(
	at sun.rmi.transport.LiveRef.exportObject(
	at sun.rmi.server.UnicastServerRef.exportObject(
	at java.rmi.server.UnicastRemoteObject.exportObject(
	at java.rmi.server.UnicastRemoteObject.exportObject(
	at org.eclipse.jetty.jmx.ConnectorServer.doStart(
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
	... 22 common frames omitted
Caused by: Address already in use (Bind failed)
	at Method)
	at org.eclipse.jetty.jmx.ConnectorServer$JMXRMIServerSocketFactory.createServerSocket(
	at org.eclipse.jetty.jmx.ConnectorServer$JMXRMIServerSocketFactory.createServerSocket(
	at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(
	at sun.rmi.transport.tcp.TCPTransport.listen(
	... 33 common frames omitted

First ensure that no other application is using the port reflected in the message ( in the example, port 1099 ).

If no other application is using this port, then the problem is encountered when step 2 from the instructions in Configure JMX in the Standard Nexus Bundle zip/tar.gz is not followed. In that case be sure to actually configure the properties specified - this will resolve the issue.

Have more questions? Submit a request


Article is closed for comments.