java.lang.NullPointerException

Hibernate JIRA | Peter Fassev | 1 decade ago
  1. 0

    ReadWrite-Cache issues NullPointerException after modification of an array. Please look at the provided Test Case, which leads to a java.lang.NullPointerException at java.lang.Integer.compareTo(Integer.java:928) at java.lang.Integer.compareTo(Integer.java:955) at org.hibernate.util.ComparableComparator.compare(ComparableComparator.java:13) at org.hibernate.cache.ReadWriteCache$Lock.isPuttable(ReadWriteCache.java:460) at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:155) at org.hibernate.engine.CollectionLoadContext.addCollectionToCache(CollectionLoadContext.java:315) at org.hibernate.engine.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:203) at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:268) at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:249) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:816) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:771) at org.hibernate.loader.Loader.doQuery(Loader.java:690) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) at org.hibernate.loader.Loader.loadCollection(Loader.java:1787) at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:52) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:500) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422) at org.hibernate.type.CollectionType.getCollection(CollectionType.java:490) at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:332) at org.hibernate.type.CollectionType.assemble(CollectionType.java:234) at org.hibernate.type.TypeFactory.assemble(TypeFactory.java:377) at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:85) at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:71) at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:510) at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:467) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:321) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:116) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:154) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:668) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:270) at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:173) at org.hibernate.collection.PersistentList.initializeFromCache(PersistentList.java:324) at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:219) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:81) at org.hibernate.collection.PersistentList.get(PersistentList.java:225) at TestCase.main(TestCase.java:72) The Exceptions occurs, when the object is loaded after a modification of a mapped Array due to the fact, that the Version of the arrays parent object (here of type B) in the PersistentContext (EntityEntry) is null. I am not sure, but I suppose, there is an error in the loading sequence of the objects, i.e. the object of type B is still not completely loaded, while the Array is going to be put into the cache. Please note: When the test case is simplified by removing the object of type A, there is no such exception. The Exception occurs in both 3.0.5 and 3.1 Beta 1. Regards Peter

    Hibernate JIRA | 1 decade ago | Peter Fassev
    java.lang.NullPointerException
  2. 0

    ReadWrite-Cache issues NullPointerException after modification of an array. Please look at the provided Test Case, which leads to a java.lang.NullPointerException at java.lang.Integer.compareTo(Integer.java:928) at java.lang.Integer.compareTo(Integer.java:955) at org.hibernate.util.ComparableComparator.compare(ComparableComparator.java:13) at org.hibernate.cache.ReadWriteCache$Lock.isPuttable(ReadWriteCache.java:460) at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:155) at org.hibernate.engine.CollectionLoadContext.addCollectionToCache(CollectionLoadContext.java:315) at org.hibernate.engine.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:203) at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:268) at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:249) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:816) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:771) at org.hibernate.loader.Loader.doQuery(Loader.java:690) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) at org.hibernate.loader.Loader.loadCollection(Loader.java:1787) at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:52) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:500) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422) at org.hibernate.type.CollectionType.getCollection(CollectionType.java:490) at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:332) at org.hibernate.type.CollectionType.assemble(CollectionType.java:234) at org.hibernate.type.TypeFactory.assemble(TypeFactory.java:377) at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:85) at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:71) at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:510) at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:467) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:321) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:116) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:154) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:668) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:270) at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:173) at org.hibernate.collection.PersistentList.initializeFromCache(PersistentList.java:324) at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:219) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:81) at org.hibernate.collection.PersistentList.get(PersistentList.java:225) at TestCase.main(TestCase.java:72) The Exceptions occurs, when the object is loaded after a modification of a mapped Array due to the fact, that the Version of the arrays parent object (here of type B) in the PersistentContext (EntityEntry) is null. I am not sure, but I suppose, there is an error in the loading sequence of the objects, i.e. the object of type B is still not completely loaded, while the Array is going to be put into the cache. Please note: When the test case is simplified by removing the object of type A, there is no such exception. The Exception occurs in both 3.0.5 and 3.1 Beta 1. Regards Peter

    Hibernate JIRA | 1 decade ago | Peter Fassev
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Can someone explain what this error means please?

    Stack Overflow | 6 years ago | Frank Burns
    java.lang.NullPointerException
  5. 0

    Inserting an Object/Integer into a Singly Linked List and sorting it

    Stack Overflow | 4 years ago | Schwarz
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at java.lang.Integer.compareTo()
    2. Java RT
      Integer.compareTo
      1. java.lang.Integer.compareTo(Integer.java:928)
      2. java.lang.Integer.compareTo(Integer.java:955)
      2 frames
    3. Hibernate
      ComparableComparator.compare
      1. org.hibernate.util.ComparableComparator.compare(ComparableComparator.java:13)
      1 frame
    4. Hibernate
      AbstractCollectionPersister.initialize
      1. org.hibernate.cache.ReadWriteCache$Lock.isPuttable(ReadWriteCache.java:460)
      2. org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:155)
      3. org.hibernate.engine.CollectionLoadContext.addCollectionToCache(CollectionLoadContext.java:315)
      4. org.hibernate.engine.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:203)
      5. org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:268)
      6. org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:249)
      7. org.hibernate.loader.Loader.endCollectionLoad(Loader.java:816)
      8. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:771)
      9. org.hibernate.loader.Loader.doQuery(Loader.java:690)
      10. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
      11. org.hibernate.loader.Loader.loadCollection(Loader.java:1787)
      12. org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:52)
      13. org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:500)
      13 frames
    5. Hibernate
      SessionImpl.initializeCollection
      1. org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
      2. org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422)
      2 frames
    6. Hibernate
      TypeFactory.assemble
      1. org.hibernate.type.CollectionType.getCollection(CollectionType.java:490)
      2. org.hibernate.type.CollectionType.resolveKey(CollectionType.java:332)
      3. org.hibernate.type.CollectionType.assemble(CollectionType.java:234)
      4. org.hibernate.type.TypeFactory.assemble(TypeFactory.java:377)
      4 frames
    7. Hibernate
      SessionImpl.internalLoad
      1. org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:85)
      2. org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:71)
      3. org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:510)
      4. org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:467)
      5. org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:321)
      6. org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:116)
      7. org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:154)
      8. org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
      9. org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:668)
      9 frames
    8. Hibernate
      ManyToOneType.assemble
      1. org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:270)
      2. org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:173)
      2 frames
    9. Hibernate
      PersistentList.get
      1. org.hibernate.collection.PersistentList.initializeFromCache(PersistentList.java:324)
      2. org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35)
      3. org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130)
      4. org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48)
      5. org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422)
      6. org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:219)
      7. org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:81)
      8. org.hibernate.collection.PersistentList.get(PersistentList.java:225)
      8 frames
    10. Unknown
      TestCase.main
      1. TestCase.main(TestCase.java:72)
      1 frame