aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Understanding JMX  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Understanding JMX  " Watch "Understanding JMX  " New topic
Author

Understanding JMX

Nirav A Mehta
Greenhorn

Joined: Jun 08, 2006
Posts: 5
Hi guys,
I have a problem understanding JMX. Suppose I have an aplication which I want to make manageable using JMX. So I create an MBean with the properties. Do I then explicitly have to run a separate program that will register it? Sound a little silly, cause if I have a web application, then how do I register and initialize this mbean as part of it? It will happen everytime a user calls for the application. The application is meant to be the client to the MBean. Since it should be a deployable application, how do I make the MBean register just once everytime the web server starts?

Nirav
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Well as an example in JBoss. you would just archive the file into a .sar and drop it into the JBoss deploy directly and the MBean will run.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Nirav A Mehta
Greenhorn

Joined: Jun 08, 2006
Posts: 5
Hi,
Just one more doubt. As far as the picking up configurable properties goes, what would be the difference between an MBean and a Entity bean with BMP? Because anyways, the configured values will have to be persisted somewhere so that each time the server restarts, the values can be retained.

Please clarify this for me. I know I have to be wrong, since JMX is such a popular choice for application management.

Nirav
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
MBeans are supposed to reflect and influence the state of whatever application they're used with - an app server in this case. It's not the responsibility of JMX to save and restore any state, it's the responsibility of the application to do that, and the MBeans will merely reflect the state of the app. If you find yourself considering adding persistence features to MBeans, you might be misusing JMX.


Ping & DNS - my free Android networking tools app
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Yeah, I wouldn't even compare MBeans to any EJB Beans. It is like comparing a JTextField in Swing with an Message Driven Bean, they are just really unrelated, so to speak.

Mark
Nirav A Mehta
Greenhorn

Joined: Jun 08, 2006
Posts: 5
Originally posted by Ulf Dittmer:
MBeans are supposed to reflect and influence the state of whatever application they're used with - an app server in this case. It's not the responsibility of JMX to save and restore any state, it's the responsibility of the application to do that, and the MBeans will merely reflect the state of the app.


Then is there a way to automatically persist some configured properties. A very common example of using JMX is to specify logging properties for an application. Suppose I change the logging properties. I dont want to lose the values when my server is restarted. I want to retain them with some kind of persistance mechanism. Can this be done? If not automatically, MBeans should have a lifecycle implementation to allow such a thing.
I was just going through Geronimo's implementation of GBeans which is sort of an extension of MBeans which kinda solves all issues that a deployable application should have. Maybe JMX can provide a similar support to make it a standard.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
Then is there a way to automatically persist some configured properties.


Persisting anything is not part of JMX. If the changes made to an applications configuration through JMX are supposed to be permanent, then the application should store those settings somewhere. You can of course put the persistence code in the MBeans, but JMX is not going to help you with that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Understanding JMX