Unlike What is a NullPointerException, and how do I fix it? I'm searching for reason why query works fine when load is low and does not work on heavy load. I would like to know if three is a way to solve it in my domain code or in eclipselink.
In eclipselink 2.5.2 under heavy load (while running tests) sometimes I'm receiving NullPointerException. I'm not able to reproduce it manually. Application runs on Linux platform with jdk-1.7.0-111_H03-linux_x64.
The stacktrace is:
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:904)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:851)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:734)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:688)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:795)
at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:890)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:509)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1751)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
The query is simple select:
SELECT location FROM LocationEntity location " +
"WHERE location.locationId IN :locationIds " +
"AND :validityDate BETWEEN location.effectiveFrom AND location.effectiveTo
from dao class annotated with:
@Stateless(name = "LocationDao")
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
The entity is annotated with:
@Entity
@Table(name = "LOCATION")
@Cache(coordinationType = CacheCoordinationType.NONE)
@ReadOnly
It looks like bug in eclipselink. Similar bug is registered under https://bugs.eclipse.org/bugs/show_bug.cgi?id=436871, but stacktrace is different, so in my opinion it is not the same problem.