Announcement Announcement Module
No announcement yet.
JBoss MBean Deployment Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JBoss MBean Deployment

    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?

  • #2
    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.


    • #3
      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?



      • #4
        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).


        • #5

          I am also trying to deploy an mbean to JBoss and it it not working.

          I wrote a class (call it class) that implements both the DynamicMBean and ServletContextListener interfaces. I also added the following to my web.xml file.


          My mbean appears fine when I deploy to Tomcat but not when I deploy to JBoss.

          Any ideas what I might be doing wrong?


          Last edited by zzpprk; Feb 22nd, 2012, 04:16 AM.