NPE在读取数据时

时间:2016-10-11 08:52:28

标签: java nullpointerexception eclipselink

What is a NullPointerException, and how do I fix it?不同,我在寻找原因时,为什么查询在负载较低时工作正常,并且在重负载时不起作用。我想知道三种是在我的域代码或eclipselink中解决它的方法。

eclipselink 2.5.2在重负载下(运行测试时)有时我接收到NullPointerException。我无法手动复制它。 应用程序在Linux平台上运行,使用jdk-1.7.0-111_H03-linux_x64。

堆栈跟踪是:

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)

查询很简单:

SELECT location FROM LocationEntity location " +
        "WHERE  location.locationId IN :locationIds " +
        "AND    :validityDate BETWEEN location.effectiveFrom AND   location.effectiveTo
来自dao类的

注释为:

@Stateless(name = "LocationDao")
@TransactionAttribute(TransactionAttributeType.SUPPORTS)

该实体注释为:

@Entity
@Table(name = "LOCATION")
@Cache(coordinationType = CacheCoordinationType.NONE)
@ReadOnly

它看起来像eclipselink中的bug。 类似的错误在https://bugs.eclipse.org/bugs/show_bug.cgi?id=436871下注册,但堆栈跟踪不同,所以在我看来这不是同一个问题。

0 个答案:

没有答案