I was struggling with this issue until yesterday. Saw your post, took some help from it. And then I faced the same problem as you did. I actually also got lucky to resolve this issue.
This is a two step process:
- The call to cacheJmxWrapper.getCache() will be actually returning cacheJmxWrapper.getCache() an instance of org.jboss.cache.invocation.CacheInvocationDelegate. Therefore, the type casting needs to be corrected here.
- java.lang.ClassCastException: org.jboss.cache.invocation.CacheInvocationDelegate cannot be cast to org.jboss.cache.Cache
at $Proxy17.getCache(Unknown Source)
This actually happenned since my both applications were using there own set of JBoss Cache related jars. And since different instances of class loaders were loading these jars, these class cast exception took place. Resolution to this was to take these Jboss cache related jars from each of the applications and store them inside the application servers instance.
The issue got resolved and a single instance of Jboss cache was accessible for both the applications.
This also answers that this is not a defect in JBoss Cache.