[jboss-user] [JBossCache] - Tip on use of JBC in non-JBoss AS MBeanServer

bstansberry@jboss.com do-not-reply at jboss.com
Sat Nov 4 01:15:33 EST 2006


Tip for any users out there using JBC in a non-JBoss AS JMX environment:

Been doing some unit testing of standalone JBC (i.e. outside of JBoss AS).  This testing involved registering JBC with a JMX MBeanServer that my test would create.

Found that tests would fail with javax.management.InstanceNotFoundException: jboss.system:service=ServiceController whenever I would call TreeCache.create(), start(), stop() or destroy().

Turns out that this is because TreeCache extends a JBoss AS class, ServiceMBeanSupport.  The implementation of create(), start() stop() and destroy() come from the superclass.  And that superclass assumes that if it's registered with an MBeanServer, it must be the JBoss AS' microkernel, so it invokes an operation on the microkernel's ServiceController.  Which in my standalone setup doesn't exist, hence the failure.

Workaround for this is to not call create/start/stop/destroy.  Instead call createService/startService/stopService/destroyService.  That's where the real work gets done anyway.

For JBC 2.0 the legacy inheritance from ServiceMBeanSupport has been removed.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983170#3983170

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983170



More information about the jboss-user mailing list