We are using pretty much the same version of JBoss as 3 years ago when working on
This means that no new tools are available in JBoss to solve cache access problem.
After extensive search, no solution to expose same Cache instance both to Hibernate and CacheManager using JMX/JNDI was found.
I went through previously suggested solutions and I can confirm it is still not working.
Another person, independently from my research, came to same conclusions:
My never answered post is even referenced by that person:
There were many other hints in forums leading to conclusion that currently it can't be fixed.
This may be possible after upgrade to newer major JBoss version, but for LAMS 2.4 another solution was needed.
CacheManager gets now Hibernate SessionFactory injected. This way it can in limited manner manipulate 2nd level cache.
As full access to Cache is unavailable, some of the ICacheManager methods (like add object to cache) now throw an exception. They were not removed for future reference when JMX/JNDI or other way of Cache exposure will become available.
This way only a little part of CacheManager actually works, but it is enough for its only usage in Sysadmin Cache Management view.
Administrator can still view cacheable classes and remove objects of a certain class from 2nd level cache.
This approach should be considered temporary until a better solution allowing full Cache manipulation is found.
Comments and changes were made to source code to reflect current state.
The attached cache configuration will be unused for LAMS 2.4 release, so it was removed from source code, but it can be found here for future reference.
If current solution is accepted for LAMS 2.4 this JIRA can be either closed or moved for 2.4.1.