Peter Petrovics [http://community.jboss.org/people/szerintedmi] created the 
discussion

"exception from CacheJmxWrapperMBean.getCache()"

To view the discussion, visit: http://community.jboss.org/message/547863#547863

--------------------------------------------------------------
I'm trying to reach the same cache from two different webapps running on the 
same Tomcat.

The first time it starts I'm registering with the following code:
{code}
jbossCache = new DefaultCacheFactory().createCache(configFile);
cacheJmxWrapper = new CacheJmxWrapper(jbossCache);

ObjectInstance oi = mBeanServer.registerMBean(cacheJmxWrapper, on);
// tryied this way too:
//JmxRegistrationManager jmxRegManager = new  
JmxRegistrationManager(mBeanServer, jbossCache, on);
 //jmxRegManager.registerAllMBeans();

log.info("Cache started. MBean objName: " + oi.getObjectName());
{code}

I try to get a reference through JMX with this code:
{code}
mBeanServer = ManagementFactory.getPlatformMBeanServer();

cacheJmxWrapper =
                        (CacheJmxWrapperMBean) 
MBeanServerInvocationHandler.newProxyInstance(mBeanServer, on,
                        CacheJmxWrapperMBean.class, false);

Object o;   // just to show the issue
o = cacheJmxWrapper.getCache();
{code}

I receive the following exception from the last line:
{code}
java.lang.ClassCastException: 
org.jboss.cache.invocation.CacheInvocationDelegate cannot be cast to 
org.jboss.cache.Cache
        at $Proxy17.getCache(Unknown Source)
{code}
I tried several different methods to register/get reference.
Am I missing a point or is it a bug?

As I read JNDI would be a workaroun but can't find proper description how to 
setup (and setting on production server would be a bit complicated because of 
restricted access). I there any other way to reach the same cache from 
different webapps?

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/547863#547863]

Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to