Thursday September 28, 2006 ![]() |
JMX, SNMP, Java, etc...Daniel Fuchs blogs on JMX, SNMP, Java, etc... |
... 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.
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. 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. 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: 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:
Cheers, -- danielTags: java jmx Posted by dfuchs ( Sep 28 2006, 04:49:03 PM CEST ) Permalink Comments [15] |
Posted by Matthias Ernst on September 29, 2006 at 12:57 PM CEST #
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 #
Posted by Prashant on October 03, 2006 at 09:22 AM CEST #
Posted by Matthias on October 03, 2006 at 08:22 PM CEST #
Posted by Yeray Santana Borges on November 03, 2006 at 11:12 AM CET #
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 #
Hi
I have seen use in commercial projects(im being ambigous for subtle reasons) they use jmx and rmi(provided by spring framework) to achieve single point of access for business classes. The portlets access the business logic classes using request passed to jmx server. The request happens when the portlets are initialized. I mostly havent done much of my homework to find out why? Although would appreciate any inputs.Thanks.
Posted by Pawan on September 05, 2008 at 08:03 PM CEST #
Essentially the question is whether jmx can be used to access a business class as is,because we are getting the same functionality that of EJBs(the spring bean is being registered with a jmx server as an mbean,and the portlets are requesting the bean from the jmx server). The process of requesting the mbean is also happening using spring initialization that happens when the spring portlet initializes.This essentially is a very good substitute for using EJB.
Posted by Pawan on September 05, 2008 at 08:13 PM CEST #
Hi,
Daniel!you are given the information regarding http://forum.java.sun.com is very useful for me
Thank you so much!
Posted by Sportswear on November 05, 2008 at 11:10 AM CET #
rtert
Posted by 124.125.172.134 on February 26, 2009 at 05:50 AM CET #