try {
log.info("start to register all JBoss Treecache MBeans...");
CacheFactory factory = new DefaultCacheFactory();
Cache cache = factory.createCache("treecache.xml");
ObjectName cacheObjectName = new ObjectName("jboss.cache:service=Cache");
JmxRegistrationManager jmxRegistrationManager = new JmxRegistrationManager(server, cache, cacheObjectName );
jmxRegistrationManager.registerAllMBeans();
log.info("registered all JBoss Treecache MBeans");
} catch (MalformedObjectNameException e) {
log.warn("JMX-Error : Can not register as MBean, MalformedObjectNameException=", e);
} catch (NoSuchBeanDefinitionException e) {
log.warn("JMX-Error : Can not register as MBean, NoSuchBeanDefinitionException=", e);