Total Pageviews

Thursday, June 28, 2012

Alternatives to Spring JMX exporter in JSE/JEE without using Spring framework


Question:
Is there anything similar to the Spring JMX exporter out there WITHOUT using the Spring framework? SimpleJMX (http://256.com/sources/simplejmx/) seems to be reasonable but seems also to be a very young framework pushed only by a single person.

I'm in need of exposing a whole bunch of attributes, methods and classes as JMX but don't want to fiddle with the JMX API and writing tons of JMX interfaces. And there is no way to introduce Spring in the project (just in case you ask). Any hints or ideas are greatly appreciated :-)

Answer:
Ok, I have quickly evaluated SimpleJMX and JMXUtils. Both work as expected and are very similar to the Spring JMX exporter. However, I find JMXUtils to be more usable in my case.

With JMXUtils it is very easy to register/unregister MBeans to an already started platform mbean server. In my case I was using GlassFish V3 as application server and I didn't want to start another MBean Server just for my own mbeans.

As far as I can see the API of SimpleJMX does not allow this and you are either forced to start another MBeanServer using the SimpleJMX API and register the created mbeans (very easy with the API) or you start fiddling around with trying to register the mbeans into the platform mbean server. The later is a little bit more complicated and therefore I decided to use JMXUtils.

The downside of JMXUtils is the manipulation of the bean name. SimpleJMX uses attributes in annotations (domainName, beanName) which is very useful but with JMXUtils you have to know the syntax for naming mbeans when using mbean domains. All in all not a big deal but for my taste SimpleJMX has the better solution for this.

The bottom line is, that both libraries are great and do their job. I decided to use JMXUtils.

This question was also posted in this stackoverflow topic.

1 comment:

  1. This article explores useful alternatives to Spring's JMX exporter for those working in JSE/JEE environments without the Spring framework! It's a great resource for developers looking for lightweight solutions. If you're also a gamer, rocksdb is a fantastic tool to help you organize your game library while diving into JMX management.

    ReplyDelete