We have this code based on what's in the documentation, in order to get our cache (deployed using the jmx microcontainer) and return it to our application code:
final MBeanServer server = MBeanServerLocator.locateJBoss();
final ObjectName objectName = new ObjectName(sCacheName);
final CacheJmxWrapperMBean<String, Object> cacheWrapper =
server, objectName, CacheJmxWrapperMBean.class, true);
sCache = cacheWrapper.getCache();
But CacheJmxWrapperMBean is deprecated.
What's the correct way to get the cache now?
JMX should primarily be used for management information and not as a registry of services, this is why the component is deprecated.
You should have your own code create and register the cache in JNDI and your client code look up the cache from JNDI.