[Solved] Error: JMX connector server communication and Port already in use: 1099 in Kafka | Big Data | Kafka | Ksql

In this post, we will explain how to resolve JMX connector server communication error and port related issues in Kafka, Ksql(Confluent ksqlDB), Tomcat and other services in the Big Data cluster.



JMX connector server communication error:

Error: JMX connector server communication error: service:jmx:rmi://hostname/localhost:1099
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:800)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:468)
at sun.management.Agent.startAgent(Agent.java:262)
at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:346)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:254)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:237)
at sun.management.jmxremote.ConnectorBootstrap$PermanentExporter.exportObject(ConnectorBootstrap.java:199)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:146)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:122)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:404)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:796)
... 3 more
Caused by: java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:513)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:128)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
... 12 more

Solution:

The above error is common in Kafka, tomcat, and other services. Here we provided simple solution for this issue.




Step 1: First, unset the JMX_PORT using below command:

unset JMX_PORT

Step 2: Once, unset the JMX port then kill the Ksql port 1099

kill -9 1099

Note: in case if you will get below error in your log file, otherwise don’t kill the port

Caused by: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net.BindException: Address already in use (Bind failed)

Step 3: After killed the port then go to environment variables, after that commented the below lines with “#”

#export KSQL_JMX_OPTS

Step 4:  Once completed the above steps then kill the ksql service.

Step 5: Then start Kafka and Ksql services in the Big Data/Hadoop cluster.




The above resolution is very simple for Big Data/ Kafka administrators and Hortonworks/Cloudera, this error is common in Ksql, tomcat services. If will showing port already in use then kill that port and try it, else JMX connection error then proceed with above steps. In case still getting same error comment it.