View Full Version : JBoss MBean Deployment
redijedi
Oct 7th, 2005, 12:19 AM
I am new to working with Spring + JMX. I have created a sar with an applicationContext that wires my beans as described in the Spring reference. However, I do not see the MBean deploy. I am unsure as to what information to put in the jboss-service.xml, which I believe is required for MBean registration. The docs say that Spring will register the beans, but I do not see any loading or registration ocurring. Is there something more to deploying sars with Spring that is not mentioned in the reference?
Costin Leau
Oct 7th, 2005, 02:10 AM
Spring needs to be started somehow but the container you are working with. I don't know what the case for JBoss but for Tomcat there is the ContextListener (this can be used also in JBoss, ofc).
However note that SARs are archives packed in JBoss specific format and JBoss should take care of deploying them. The mbeans are read and deployed by JBoss itself without the need of Spring.
Ofc, you can still use Spring to deploy mbean inside the JMX server but for that, as I said you have to bootstrap Spring which means changing your archive from sar to a simple war cofigured with ContextLstener inside the web.xml file.
Note that this will work on any container which provides a JMX server (be it Tomcat, Jboss or Weblogic and so on) while SARs are JBoss-specific.
redijedi
Oct 7th, 2005, 11:29 AM
Thanks for your quick reply. I was hoping to wire my beans using Spring and deploy to JBoss. Since JBoss requires a specific bean to implement the MBean interface, and have that bean described in the jboss-service.xml deployment descriptor in order to deploy it, how shall I deploy a Spring managed POJO?
I suppose I can create a business delegate, and use that to wire into JBoss, but will Spring get loaded in order for me to take advantage of the bean wiring in this case?
Thanks
Costin Leau
Oct 7th, 2005, 11:59 AM
but will Spring get loaded in order for me to take advantage of the bean wiring in this case?
Unless Spring it's bootstrapped there isn't much you can do. Your object have to be managed by somebody Spring or JBoss - I don't think there is a bridge to make Spring and JBoss work together (i.e. make JBoss ask Spring for objects). JBoss also uses some sort of IoC to manage the objects you deploy inside the application server so Spring is not able to perform any IoC on them because its not controling the objects.
What you can do is create a war file and start Spring through a context listener and publish your object through Spring to JMX. However you should check out the reference documentation and the EJB forum - maybe there is a better solution for making JBoss and Spring play together nicely :).
I haven't used Spring in such an environment so I can't comment (I actually moved an app from JBoss/EJB to Tomcat/Spring).
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.