Aug. 9, 2011, 8:42 a.m.
IT

My MBeans do not show up in jmx-console on Jboss 6

I have been trying to port an application of mine to JBoss 6, and managed to get there from JBoss 5.1.0.CR1 without too much hassle. However my MBeans did not show up...

I could find no information as to why this is broken on the wonderful internet. I tried posting on JBoss' forums but as usual, I was ignored on there. Never get any responses. Guess you have to pay for that. I am digressing.

Eventually I figured it out. Here are the details:

(For historical purposes) going from JBoss 4.x to 5.x you MUST recompile your code and change the @Service and @Management tags from:

import org.jboss.annotation.ejb.Management;
import org.jboss.annotation.ejb.Service;

which was in package jboss-annotations-ejb3.jar to

import org.jboss.ejb3.annotation.Management;
import org.jboss.ejb3.annotation.Service;

in package jboss-ejb3-ext-api.jar.

Going from JBoss 5.x to 6.x, a stricter check was enforced on the location of your MBeans. On JBoss 5.x bundling them in the app.ear/lib directory worked, this stopped working on 6.x. The solution is to ensure the .jar that contains the MBeans have been deployed to the app.ear/ directory (the root of the .ear), and that you mentioned the module in your application.xml file:

<module>
    <ejb>mbeans.jar</ejb>
</module>

As a refresher, this is how I mark my POJO's as JMX beans:

@Service(objectName = "AppName.MBeans:service=NotificationScheduler")
@Management(NotificationSchedulerMBean.class)
public class NotificationScheduler implements NotificationSchedulerMBean {
   // ...
}

public interface NotificationSchedulerMBean {  
  // ...
} 

That is it! No XML descriptors needed as was the case in older JBoss...