Uploaded image for project: 'LAMS Development'
  1. LAMS Development
  2. LDEV-2811

Make Cache available to Cache Manager in JBoss 5

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: General
    • Labels:
      None

      Description

      When upgrading to JBoss 5 some old ideas had to be abandoned. One of them was Cache access using JMX. The issue was described in detail in comments to LDEV-2071, chapter 5 "Cache".
      As LAMS 2.4 release is coming soon, a way to expose Cache to Cache Manager needs to be found.
      Otherwise Cache Manager needs to be hidden from Sysadmin menu as it is not functioning anymore. It throws
      javax.management.InstanceNotFoundException: jboss.cache:service=TreeCache is not registered.
      exception.

        Activity

        Hide
        marcin Marcin Cieslak added a comment -
        We are using pretty much the same version of JBoss as 3 years ago when working on LDEV-2071.
        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:
        http://www.len.ro/work/hibernate-jbosscache-integration/
        My never answered post is even referenced by that person:
        https://community.jboss.org/message/270922
        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.
        Show
        marcin Marcin Cieslak added a comment - We are using pretty much the same version of JBoss as 3 years ago when working on LDEV-2071 . 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: http://www.len.ro/work/hibernate-jbosscache-integration/ My never answered post is even referenced by that person: https://community.jboss.org/message/270922 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.
        Hide
        marcin Marcin Cieslak added a comment -
        Warning: not all committed files are reflected in the chagelog of previous commit! There were more changes made.
        Show
        marcin Marcin Cieslak added a comment - Warning: not all committed files are reflected in the chagelog of previous commit! There were more changes made.
        Hide
        marcin Marcin Cieslak added a comment -
        This helpful code snippet was used for solution:
        http://java.dzone.com/tips/clearing-hibernate-second-leve
        Show
        marcin Marcin Cieslak added a comment - This helpful code snippet was used for solution: http://java.dzone.com/tips/clearing-hibernate-second-leve
        Hide
        ernieg Ernie Ghiglione added a comment -
        Done
        Show
        ernieg Ernie Ghiglione added a comment - Done

          People

          • Assignee:
            marcin Marcin Cieslak
            Reporter:
            marcin Marcin Cieslak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development