I am getting a NullPointer from EclipseLink during Lazy loading of Children. This is not happening always, but it happens once in a while and once it gets into this exception, it keeps throwing the same NullPointer then on. My Entity Structure is:
EntityLevel1 ->
EntityLevel2 ->
EntityLevel3
Nullpointer happens when we say
List<EntityLevel3> entityLevel3list = EntityLevel2.getEntityLevel3List();
if (CollectionUtils.isEmtpy(entityLevel3list)) { // NullPointer exception is here
}
Below is the exception stack trace
BeanInvokerService.java:135)\n\t... 50 more\nCaused by: java.lang.NullPointerException\n\tat org.eclipse.persistence.internal.sessions.AbstractSession.executeDeferredEvents(AbstractSession.java:1507)\n\tat org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2897)\n\tat org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857)\n\tat org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839)\n\tat org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:133)\n\tat org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:120)\n\tat org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)\n\tat org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:173)\n\tat org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:234)\n\tat org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)\n\tat org.eclipse.persistence.indirection.IndirectList.buildDelegate(IndirectList.java:271)\n\tat org.eclipse.persistence.indirection.IndirectList.getDelegate(IndirectList.java:455)\n\tat org.eclipse.persistence.indirection.IndirectList.isEmpty(IndirectList.java:537)\n\tat java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)\n\tat org.apache.commons.collections.CollectionUtils.isEmpty(CollectionUtils.java:979)\n\tat org.apache.commons.collections.CollectionUtils.isNotEmpty(CollectionUtils.java:992)\n\tat c
If anyone has come across this exception, can you please help me explain the root cause for this?
We have tried reproducing this by invoking the same api several times, but no luck.