I have an MBean service that is used by bundled in two EARs with different object names. The two EARs are deployed in the same app server. Each EAR has its own copy of the same MBean classes (same package, same class name) except that at build time, I change the actual @Service(ObjectName) to be unique.
For some reason, even though I deployed the two EARs with the same MBean class with different object names, JBoss loads the first MBean instance from the first EAR. When it tries to load the second MBean instance from the second EAR, it uses the objectName defined in the first loaded MBean instance. It looks as if it is using the same class loader to load both MBeans and therefore does not pick up the difference in the second MBean.
Is this the intentded behavior? Is there an EJB3 annotation I can use to force the app server to load each of the MBean services seperately in each EAR?