[jboss-user] [Management, JMX/JBoss] - Re: auto redeploy dynamic mbean on JBoss restart

cnsxxx09 do-not-reply at jboss.com
Mon Nov 6 02:43:19 EST 2006


Hi,

Three final problems before I have this working 100%.

1. Classloader.
I have all my code neatly contained in a .war package.
Now, when I use the Deployment Service it creates an independent XML
service file in the deploy/ directory. JBoss cannot then find my
MBean class file to load it.
Duplicating my code and my many dependent libraries in JBoss lib/
works but .... it's not ideal. Is there an easier way to make my classes/libraries available from within my war?

2. Default MBean attributes.
When using my web-based scheduler to create these xxx-service.XML
files, I want to pass in some default values upon -initial- deployment.
I amended the xmbean part of the velocity template so I can now 'in
theory' pass in such a default value as follows:
   
      MBean Attribute.
      Id
      java.lang.String
      
         
      
   
But when the MBean  is deployed it doesn't then set this default
value, it uses the value from the MBean class:
   private String id = "";
(The persistence does work ok, if I change the value and restart
JBoss then it is correctly reset from the value in the xmbean-attrs/
directory).

I did think about subsequently looking up the MBean and then invoking
the set method,  but this is not so clean and there is an unknown
delay between deploying it and when it is ready to use which would be
ugly to factor in.

3. Remove Module.
I am going to try overriding the MBean destroy() method to physically remove my module (XML file) as follows:
     DeploymentServiceMBean.removeModule(myModuleId);
Is there any easy way to get the module Id? (which of course relates
to the name of the XXX-service.XML file, not the object name).
I can kludge this by passing it in as a default MBean value, if I get
2. working that is! But maybe there is a more elegant way?

Thanks

Chris

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983369#3983369

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983369



More information about the jboss-user mailing list