Search code examples
javajconsole

JConsole - Constant Disconnects with localhost/Kafka Sandbox


I am trying to use JConsole to monitor/view metrics for Kafka Sandbox with Docker containers. As soon as I connect to locahost:35000, I receive the error: "Secure Connection Failed: Retry Insecurely?"

enter image description here

If I click Insecure connection, the connection works for a split second and then disconnects again with a different error: "Connection Lost: Reconnect?".

enter image description here

I've researched and tried many different combinations of JMX arguments, including the arguments below and none have worked so far.

The actual exception returned in the debug log is:

java.lang.SecurityException: Expecting a sun.rmi.server.UnicastRef2 remote reference in stub!

Has anyone been able to fix this issue with JConsole?

Current arguments used:

jconsole -debug -J"-Dcom.sun.management.jmxremote=true, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -Djava.rmi.server.hostname=localhost,  -Dcom.sun.management.jmxremote.local.only=false, -Dcom.sun.management.jmxremote.rmi.port=35000, -Dcom.sun.management.jmxremote.port=35000, -Dcom.sun.management.jmxremote.port=35000"

Java Info:

java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

Docker Info:

CONTAINER ID   IMAGE                                      COMMAND                  CREATED      STATUS                  PORTS                                          NAMES
b21d9589e737   mongodb-kafka-base-setup-mongod:1.0        "bash -c 'sleep 10 &…"   4 days ago   Exited (0) 4 days ago                                                  mongo1-setup
c0a23e041e23   mongodb-kafka-base-mongod:1.0              "docker-entrypoint.s…"   4 days ago   Up 4 days               0.0.0.0:35001->27017/tcp                       mongo1
7c56b4ccc89a   confluentinc/cp-kafka-rest:7.2.2           "/etc/confluent/dock…"   4 days ago   Up 4 days               8082/tcp                                       rest-proxy
3b6fd1821270   confluentinc/cp-schema-registry:7.2.2      "/etc/confluent/dock…"   4 days ago   Exited (1) 4 days ago                                                  schema-registry
c303de030d9f   confluentinc/cp-kafka-connect-base:7.2.2   "/etc/confluent/dock…"   4 days ago   Up 4 days (healthy)     8083/tcp, 9092/tcp, 0.0.0.0:35000->35000/tcp   connect
4c1665f78d4c   confluentinc/cp-kafka:7.2.2                "/etc/confluent/dock…"   4 days ago   Up 4 days               9092/tcp                                       broker
b707c2d6b8be   confluentinc/cp-zookeeper:7.2.2            "/etc/confluent/dock…"   4 days ago   Up 4 days               2181/tcp, 2888/tcp, 3888/tcp                   zookeeper

Netstat Info:

  TCP    0.0.0.0:35000          0.0.0.0:0              LISTENING
  TCP    [::]:35000             [::]:0                 LISTENING
  TCP    [::1]:35000            [::]:0                 LISTENING

Solution

  • The fix for this issue was to update JDK to the latest version (in my case, JDK 19). After downloading/installing JDK 19 and running the updated JConsole, I no longer had the constant disconnects.

    https://www.oracle.com/java/technologies/downloads/#jdk19-windows