How do I fix a 'Failed to retrieve RMIServer stub' JMX error?

Solution 1:

You can specify same port for both JMX and RMI conversation:

-Dcom.sun.management.jmxremote.port=8084 
-Dcom.sun.management.jmxremote.rmi.port=8084 

Solution 2:

The problem is that even if JMX is configured to listen on port 8084, after the initial connection is made, the JMX host will dynamically pick a different port for the rest of the "conversation". My firewall allowed traffic through 8084, but was blocking the subsequent traffic.

There are two options.

  1. Allow inbound traffic on all ephemeral ports (yikes!).
  2. Develop a JMX wrapper that uses a single port for communication.

Solution 3:

I struggled with this same issue trying to connect to our new Tomcat8 VMs over JMX (using VisualVM). Our Linux team had to open a ticket with Redhat to help us troubleshoot. But I stumbled on this article before they could resolve our issue.

The solution as mentioned above was to add

-Dcom.sun.management.jmxremote.rmi.port=X

and X should match whatever your setting is for

-Dcom.sun.management.jmxremote.port 

Complete List of Args:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=8091
-Dcom.sun.management.jmxremote.rmi.port=8091
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=MYHOST

Hope this helps someone else having the same issue. Good luck!

Tags:

Java

Tomcat

Jmx