0

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
user2966445
  • 1,267
  • 16
  • 39
  • You'll need to show your docker run command or compose files. Otherwise, this doesn't seem like a problem specific to any image (kafka, or otherwise). – OneCricketeer Jan 08 '23 at 16:01
  • Perhaps the docker container doesn't bind to that port? `docker ps -a` or `netstat -anp | grep 35000` may show a clue.. – murtiko Jan 08 '23 at 19:48
  • @murtiko I've updated the post with the Docker/Netstat info. Looks like port 35000 is correct. When I look at the logs on the Docker side, the error just says `WARNING: The server has decided to close this client connection.` – user2966445 Jan 08 '23 at 20:08
  • Yes it looks like the port is correctly configured and being listened on. Strange, maybe [this other question/thread](https://stackoverflow.com/questions/29412072/how-to-access-spring-boot-jmx-remotely) may help. It may not be a problem but i noticed that you provide the jmx related JVM args to jconsole? Afaik these parameters are needed for the vm that you want to monitor, and not jconsole. – murtiko Jan 09 '23 at 10:00
  • 1
    @murtiko Updating to JDK 19 fixed this issue for me. Just posted the answer. – user2966445 Jan 09 '23 at 18:13

1 Answers1

0

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

user2966445
  • 1,267
  • 16
  • 39