Skip to content
Advertisement

JMX Connection does not replay when running JMXConnectorFactory.connect

Need your help to understand why I am unable to connect from a client application to a server application using JMX. I have a Server application that is initiating a JMX Bean server and a client that is trying to connect to this Server using JMX. both app are ruining on local machine in windows. Jconsole is working just fine and I am able to connect with it to the Server. But when running the client it get “stuck” on line:

JavaScript

Application side JMX Server init code:

JavaScript

Application side JMX Server JVM params:

JavaScript

My client connection to Application code :

JavaScript

A note, using

service:jmx:rmi:///jndi/rmi://:10090/jmxrmi

is working.

Advertisement

Answer

Java reference

The JMX Messaging Protocol (JMXMP) connector is a configuration of the generic connector where the transport protocol is based on TCP and the object wrapping is native Java serialization. Security is more advanced than for the RMI connector. Security is based on the Java Secure Socket Extension (JSSE), the Java Authentication and Authorization Service (JAAS), and the Simple Authentication and Security Layer (SASL).

The generic connector and its JMXMP configuration are optional, which means that they are not always included in an implementation of the JMX Remote API. The J2SE platform does not include the optional generic connector.

Note – If you want to use a JMXMP connector, download the JSR 160 Reference Implementation from http://java.sun.com/products/JavaManagement/download.html, and add the jmxremote_optional.jar file to your classpath.

Did you included jmxremote_optional.jar file in your server and client classpath?

I don’t have prior experience with JMXMP Connector approach, I followed JMX documentation and tried to verify by writing the following example and it works.

JMX MBean interface

SystemConfigMBean.java

JavaScript

A class to implement the JMX MBean interface

SystemConfig.java

JavaScript

Creating and Registering the MBean in the MBean Server using JMXMP connector

SystemConfigManagement.java

JavaScript

JMXMP Connector Client

SystemConfigManagementClient.java

JavaScript

NOTE: I have downloaded jmxremote_optional.jar file and kept in project classpath.

Execution:

Server Output:

JavaScript

Client Output:

JavaScript

I am not sure about the Server code you have written, looks like that code is expecting RMIConnector. Thus from Client the Connection attempt using RMI connector Java Remote Method Protocol (JRMP) is working.

Even you have passed property -Dcom.sun.management.jmxremote.port=portNum This property indicate, portNum is the port number through which you want to enable JMX RMI connections.

NOTE: For demo purpose I didn’t show the secure handling stuff, in real code those need to be in place.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement