I’ve been working with the JVM either directly, or indirectly throughout my professional career. With that being said, I had never used JMX for anything. Recently I’ve been working with systems that use JMX to expose a number of pieces of functionality. The whole thing just really feels poorly suited to this purpose…
Obscure Integration Point
When trying to integrate with another system - whether internally, or belonging to a partner organization, saying that they need to integrate through JMX is just bad. First, the libraries available are a very, very small set:
- Ruby (all require JRuby!)
Many of these have been abandoned for years and only offer limited functionality (or even just a thin facade).
Contrast that with using a REST-based approach! HTTP is been around for a little while, and its support in most popular programming languages is mature, robust, and actively developed.
Not NAT Friendly
When connecting to a JMX connector, the client hits a well
defined host and port, only to have the server reply back
with “I’m gonna let you finish and all, but connect back to
me at some other address and a random non-privileged port”.
This means if the server does not know what it’s externally
addressable hostname is, the connection will fail. Worse,
if the hostname is indeed different, it must be provided as
a vm option!
This also implies that JMX doesn’t play well with SSH tunnels.
With a back-and-forth connection negotion, URIs that look
service:jmx:iiop:///jndi/iiop://host:port/weblogic.management.mbeanservers.runtime, and tools and documentation
that appears to have not been touched since Sun existed, JMX
is a pretty arcane art. Good luck finding help with it, and
god help you if you need to get something up and running
A Better Integration Mechanism
REST, REST, REST! It’s extremely common, mature, and intuitive. There’s absolutely no reason why a complex system should have complex integration points - it’s just going to make pain for everyone involved.
So What Can I Use JMX For?
Even on those points however, better tool sets exist…
If you’re thinking about using JMX for something, think twice about it. If you’re thinking of using it for an integration point, please, just don’t.