Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-8370

CLONE - NullPointerException using Hibernate SecondLevel Cache at InitialState phase

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • EAP_EWP 5.2.0
    • EAP 5.0.1
    • Clustering, Hibernate
    • None
    • JBoss EAP 5.1.0, JDK 1.6 Sun/Oracle, Fedora 14

    • Hide

      Attached here simple classes for test. The Entity is cacheable:

      @Entity
      @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      public class Entity1 implements Serializable {
      ...

      To test:

      • set DEBUG level for JBossCache in JBoss
      • make the deployment of .ear (attached) on two JBoss clustered instances
      • start the first instance
      • execute a lookup to EJB, and insert a entity. For example (Main.class attached):

      public static void main(String[] args) {
      try

      { InitialContext context = new InitialContext(); SessionIF sessionIF = (SessionIF) context.lookup("seamejbtest-ear/Session1/remote"); sessionIF.createEntity(1l, "Alessandro", 19); }

      catch (Exception e)

      { e.printStackTrace(); }

      }

      • look in jmx-console the mbean: config=timestamps-cache,service=Cache and click on the method printCacheDetails. In the tree is visible the entity
      • start the second instance
      • look server.log of the second instance, you should find the exception: "Caught exception integrating state! org.jboss.cache.CacheException: java.lang.NullPointerException"
      • look in jmx-console of your second instance the mbean: config=timestamps-cache,service=Cache and click on the method printCacheDetails. In this tree, the entity is not found, because the cache not caught the previous state of the cluster.
      Show
      Attached here simple classes for test. The Entity is cacheable: @Entity @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL) public class Entity1 implements Serializable { ... To test: set DEBUG level for JBossCache in JBoss make the deployment of .ear (attached) on two JBoss clustered instances start the first instance execute a lookup to EJB, and insert a entity. For example (Main.class attached): public static void main(String[] args) { try { InitialContext context = new InitialContext(); SessionIF sessionIF = (SessionIF) context.lookup("seamejbtest-ear/Session1/remote"); sessionIF.createEntity(1l, "Alessandro", 19); } catch (Exception e) { e.printStackTrace(); } } look in jmx-console the mbean: config=timestamps-cache,service=Cache and click on the method printCacheDetails. In the tree is visible the entity start the second instance look server.log of the second instance, you should find the exception: "Caught exception integrating state! org.jboss.cache.CacheException: java.lang.NullPointerException" look in jmx-console of your second instance the mbean: config=timestamps-cache,service=Cache and click on the method printCacheDetails. In this tree, the entity is not found, because the cache not caught the previous state of the cluster.
    • Release Notes
    • Hide

      Disable query cache.
      In persistence.xml:
      <property name="hibernate.cache.use_query_cache" value="false"/>
      or omit altogether (query cache is disabled by default).

      Show
      Disable query cache. In persistence.xml: <property name="hibernate.cache.use_query_cache" value="false"/> or omit altogether (query cache is disabled by default).
    • Hide
      With JBossCache configured as a second-level cache for Hibernate, and TimeStampsRegionImpl enabled, a Null Pointer Exception (NPE) could occur on initialization of the cache. To prevent this occurring, an additional check has been added for these circumstances, preventing the NPE and ensuring the cache is initialized correctly.
      Show
      With JBossCache configured as a second-level cache for Hibernate, and TimeStampsRegionImpl enabled, a Null Pointer Exception (NPE) could occur on initialization of the cache. To prevent this occurring, an additional check has been added for these circumstances, preventing the NPE and ensuring the cache is initialized correctly.
    • Documented as Resolved Issue

    Description

      At a JBoss Cluster, when Hibernate is configured to use Second Level Cache in JBossCache2 with timestamp setting, the second JBoss instance to be initialized throws NullPointerException, starting State Integration.

      You just note this exception if change log level category for JBossCache to DEBUG:

      jboss-log4j.xml:

      <category name="org.jboss.cache">
      <priority value="DEBUG"/>
      </category>

      The exception in server.log (full log attached):

      2010-11-24 00:22:35,779 DEBUG [org.jboss.cache.remoting.jgroups.ChannelMessageListener] (Incoming-5,127.0.0.1:55200) Caught exception integrating state!
      org.jboss.cache.CacheException: java.lang.NullPointerException
      at org.jboss.cache.statetransfer.DefaultStateTransferIntegrator.integrateTransientState(DefaultStateTransferIntegrator.java:251)
      at org.jboss.cache.statetransfer.DefaultStateTransferIntegrator.integrateState(DefaultStateTransferIntegrator.java:113)
      at org.jboss.cache.statetransfer.DefaultStateTransferManager.setState(DefaultStateTransferManager.java:201)
      at org.jboss.cache.statetransfer.DefaultStateTransferManager.setState(DefaultStateTransferManager.java:165)
      ...
      Caused by: java.lang.NullPointerException
      at org.hibernate.cache.jbc2.timestamp.TimestampsRegionImpl.nodeModified(TimestampsRegionImpl.java:165)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.cache.notifications.NotifierImpl$ListenerInvocation$1.run(NotifierImpl.java:720)

      As integration state fails, the new node's cache is not updated with cluster cached values

      Attachments

        Issue Links

          Activity

            People

              rhn-support-alazarot Alessandro Lazarotti
              rhn-support-alazarot Alessandro Lazarotti
              Russell Dickenson Russell Dickenson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: