This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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.
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.
Nirav A Mehta
Joined: Jun 08, 2006
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.
Joined: Mar 22, 2005
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.