I also tried and wrote a service extending MBeanService so that a shutdown calls its stop method, in which I explicitly invoke stop on my JBoss-independant MBean. This doesn't work, because it is already unreistered from server...
How are you deploying the MBean?
If you use a service.xml, you can specify an
MBean dependency. There are examples of this in the
I deploy my main MBean via an sevice.xml. Then other MBeans are created and registered by code.
I will try to put dependencies, but just to be sure :
if A depends on B, A is started after B, OK; now is it stopped before B?