java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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
    via by Peter Fassev,
  • 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
    via by Peter Fassev,
  • Comparable to sort a set of numbers in an array
    via Stack Overflow by sam
    ,
    • 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)
    No Bugmate found.