I'm getting a NullPointerException from inside the MessageHelper class. I can cause this exception to be thrown every time using the website I'm developing on, but have been unable to create an isolated test case. To make things worse, when I debug, depending on what breakpoints I stop on and for how long, the NPE may or may not be thrown. I've been able to establish that the NPE is thrown when session.getPersistenceContext().getEntry(collection.getOwner()) returns null.
The top of the stack trace is: {noformat} java.lang.NullPointerException: null at org.hibernate.pretty.MessageHelper.collectionInfoString(MessageHelper.java:280) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.EvictVisitor.evictCollection(EvictVisitor.java:80) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.EvictVisitor.evictCollection(EvictVisitor.java:74) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.EvictVisitor.processCollection(EvictVisitor.java:56) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:121) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:82) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.AbstractVisitor.process(AbstractVisitor.java:143) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.DefaultEvictEventListener.doEvict(DefaultEvictEventListener.java:136) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:97) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.internal.SessionImpl.fireEvict(SessionImpl.java:1149) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.internal.SessionImpl.evict(SessionImpl.java:1142) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.spi.CascadingAction$4.cascade(CascadingAction.java:229) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:396) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:339) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:426) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:366) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:342) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:164) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:130) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.DefaultEvictEventListener.doEvict(DefaultEvictEventListener.java:145) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.event.internal.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:97) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.internal.SessionImpl.fireEvict(SessionImpl.java:1149) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.internal.SessionImpl.evict(SessionImpl.java:1142) ~[hibernate-core-4.2.18.Final.jar:4.2.18.Final] at org.hibernate.ejb.AbstractEntityManagerImpl.detach(AbstractEntityManagerImpl.java:1075) ~[hibernate-entitymanager-4.2.18.Final.jar:4.2.18.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) ~[spring-orm-4.1.6.RELEASE.jar:4.1.6.RELEASE] at com.sun.proxy.$Proxy103.detach(Unknown Source) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31] at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:291) ~[spring-orm-4.1.6.RELEASE.jar:4.1.6.RELEASE] at com.sun.proxy.$Proxy103.detach(Unknown Source) ~[na:na] {noformat} |
|