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.