About Me

JMX, SNMP, Java, etc...

Daniel Fuchs blogs on JMX, SNMP, Java, etc...

All | Personal | Sun
tags: blogging firewall hg java jconsole jmx jvm management mbean mercurial monitoring opendmk openjdk opensource rmi snmp

Table Of Contents (list all entries)

« JMX: Nick Stephen... | Main | Gnome Hell »
20060928 Thursday September 28, 2006
What is JMX?

... recently I had to answer to this question on the SDN JMX forum. Since it is quite a recurrent question I decided to turn this into a blog. And to spice it a little more, I'm even going to allude to some of what JMX(tm) - Java Management Extensions - is not ...

What is JMX?

To make it short, JMX is a technology that lets you implement management interfaces for Java applications.

A management interface, as defined by JMX, is composed of named objects - called MBeans (Management Beans). MBeans are registered with a name (an ObjectName) in an MBeanServer. To manage (a) resource(s) in your application, you will write an MBean that defines its management interface, and then register that MBean in your MBeanServer.
The content of the MBeanServer can then be exposed through various protocols, implemented by protocol connectors, or protocol adaptors.

A protocol connector (e.g. the JMX RMI Connector) exposes the MBeans as they are - so a remote client sees the same model than a local client.
A protocol adaptor (e.g. an SNMP adaptor, or HTML adaptor) performs (or provides hooks to let you perform) a model mediation - to adapt the model to what a client of that protocol (e.g. SNMP Manager, or Web Browser) would expect to see.

Today there is one standard connector defined for JMX - which is the RMI Connector, and comes in two flavors: RMI/JRMP and RMI/IIOP. There's also a JMX WebServices Connector in the making - which is being defined by JSR 262.

There are also a number of non-standard connectors and adaptors, either free or commercial, that have been implemented by the community.

A good place to start learning about JMX is the Trail: Java Management Extensions (JMX) from the online Java Tutorials.
More on JMX: Looking for JMX Overview, Examples, and More...

Are there examples of concrete and real situations where JMX has been used, and how?

You will find more on tools/products using JMX on the JMX Home Page.

But among other things, JMX is used today to manage the JVM itself. It is also widely used in the management of application servers.

See also:

Using JConsole to Monitor Applications
Mandy Chung's Blog - lots of articles on JVM management.
Understanding JMX Technology
Getting Started with Java Management Extensions (JMX): Developing Management and Monitoring Solutions
GlassFish Project - AMX (Appserver Management EXtensions) home page
Managing and Monitoring Web Services in Project GlassFish
Using Custom MBeans to Extend the GlassFish Administration System
Managing OpenDS with JMX and JConsole

... and also somewhat more adventurous applications!

What is the difference between MBeans and EJBs?

An EJB lives in an Application Server container. It usually implements business logic. An MBean lives in an MBeanServer, and usually implements management logic (configuration, monitoring, etc)...

See the comments below for a little more flesh ;-)

Note also that JMX is a J2SE technology - it's now part of the JDK - and can be use to manage and monitor both J2EE applications and plain J2SE applications.

Got more questions?

Maybe you'll find your answer in some of these few other interesting places.

What JMX is not...

Well now that we have gone through what JMX is, let's see some examples of what JMX(tm) (Java Management Extensions) is not:

... and probably still much more!

Cheers,

-- daniel
Tags:
Posted by dfuchs ( Sep 28 2006, 04:49:03 PM CEST ) Permalink Comments [11]

Trackback URL: http://blogs.sun.com/jmxetc/entry/what_is_jmx
Comments:

I think your EJB differentiator could need some more flesh: Is JMX(remote) a distributed object system? What is it that differentiates JMX from such? Where do you draw the line between remote application access and management? I find these guidelines underrepresented in the discussion.

Posted by Matthias Ernst on September 29, 2006 at 12:57 PM CEST #

Hi Matthias,

Yes you are right, they are under represented, maybe because I'm not a J2EE expert ;-) - so I've sticked to the bare bones: the difference between the business logic - the service itself implemented/provided by an application, and the management logic - the management of that service/application.

The classic example we usually take here is that of a cache - which would offer methods to put data in the cache and get cached data from the cache.
Accessing cached data, putting data in the cache, etc... is in that example the business logic of the cache.
Configuring the capacity of the cache, monitoring its current occupation ratio, firing notifications if it overflows, and resizing the cache capacity would constitute its management logic.

This is where I would draw the line.

Assuming you have done the work to categorize what is business logic and what is management logic in your application, you will use EJBs to implement/expose your business logic, and you will use MBeans to implement/expose the management logic.

Of course the EJBs and MBeans will need to conspire behind the scene - so that the MBeans can get data or tweak the behavior of the managed resources, or so that the EJBs can update/refresh the states/data reported by the MBeans.

Eamonn did a very interesting talk on this subject (linking MBeans with Managed Resources) at last Java One.

I don't know whether you can say that JMX is a distributed object system (= I believe it's not), but you will be able to use JMX to implement distributed management solutions, should you choose to do so.
One of the features discussed for JSR 255 (JMX 2.0) is precisely federation of MBeans/MBeanServers which should ease such implementations.

Thanks for your feedback!

-- daniel

Posted by daniel on September 29, 2006 at 03:14 PM CEST #

On differentiator between EJB, MBean : You can say that one of the protocol connectors for an MBean Server can be a EJB. http://java.sun.com/j2ee/1.4/docs/api/javax/management/j2ee/ManagementHome.html I agree with you on core differentiator of EJB=Biz logic, MBean=Management Logic.

Posted by Prashant on October 03, 2006 at 09:22 AM CEST #

There's some followup questions to be asked. What is inherently "management" that explains why JMX needed to define its own "Bean" abstraction, its own definition of "attribute" and "operation" instead of simply building on the Java bean concept? Why wouldn't one simply use POJOs and some remoting protocol? Interestingly, JMX shines because JMXRemote + Jconsole make it super simple to display some stats but -conceptually- how is "management" different that it warrants such a specification?

Posted by Matthias on October 03, 2006 at 08:22 PM CEST #

Hi, Why not use only RMI for distributed application? When is need use JMX over RMI?

Posted by Yeray Santana Borges on November 03, 2006 at 11:12 AM CET #

See the followup here: Easy Is Not Always Simple. cheers, -- daniel [8+50=58]

Posted by Daniel on November 09, 2006 at 03:56 PM CET #

Differences between SNMP and JMX

Posted by K.Rajasekaran on August 21, 2007 at 02:54 PM CEST #

Hi K.Rajasekaran,

Please see:
JVM Monitoring: JMX or SNMP? on this subject!
http://blogs.sun.com/jmxetc/entry/jmx_vs_snmp

-- daniel

Posted by 82.253.235.246 on August 27, 2007 at 10:00 AM CEST #

Hello, Daniel! I write you without any reason. Well... I have a reason. I wanna thank you. Everything you write here and at the http://forum.java.sun.com is very very very helpful. I don't know what would I do without you! There is not enough information on JMX for me. But with your help I survived! Thank you so much!
Alina

Posted by Alina on September 10, 2007 at 12:22 PM CEST #

Hello!

I'm not very skilled in Java. I wat to ask. I have two war applications on my server. And I want that one war app can use seevices of second. I use rmi services. Is any better way to make it? is JMX suitable for such thing?

Thanks.

Posted by modrofuz on October 03, 2007 at 03:42 PM CEST #

hi daniel
this is good blog as we got some information regarding jmx

Posted by abcd on May 24, 2008 at 07:31 AM CEST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed
[Table Of Contents]

This is a personal Weblog, and I do not speak for my employer.

Calendar

RSS Feeds

DFuchs on DZone

Search

Links

Lookup RFC

Planet JMX

From Grenoble

Navigation

Referers