IBM Support

PI52209: ENTITYNOTFOUNDEXCEPTION IN OPENJPA

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The customer uses JPA application. In customer's code, the
    following code is called concurrently with different keys from
    multiple threads.
    ---
    XxxxEntity entity = createEntity(key);
    em.persist(entity);
    ---
    
    In this code, EntityNotFoundException is sometimes thrown.
    --------------------------------------------------
    <openjpa-2.2.1.1-SNAPSHOT-r422266:1438134 nonfatal store error>
    org.apache.openjpa.persistence.EntityNotFoundException: The
    instance of
    type "class <my class>"
    with oid "null" no longer exists in the data store. This may
    mean that you deleted the instance in a separate transaction,
    but this context still has a cached version.
    FailedObject:
    <my object>@408a9f9e
    at
    org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManag
    erImpl.java:3119)
    at
    org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManage
    rImpl.java:3195)
    at
    org.apache.openjpa.kernel.StateManagerImpl.fetchObjectField(Stat
    eManagerImpl.java:2435)
    at
    org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.jav
    a:462)
    at
    org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(J
    DBCStoreManager.java:764)
    at
    org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(
    DelegatingStoreManager.java:135)
    at
    org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateM
    anagerImpl.java:600)
    at
    org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManager
    Impl.java:3023)
    at
    org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:4
    4)
    at
    org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateMana
    gerImpl.java:1042)
    at
    org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2116)
    at
    org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2
    076)
    at
    org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl
    .java:1994)
    

Local fix

  • n/a
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V8.5.0 and V8.5.5.                   *
    ****************************************************************
    * PROBLEM DESCRIPTION: Concurrency issue in OpenJPA which      *
    *                      can lead to an                          *
    *                      EntityNotFoundException.                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Under heavy load (many concurrent requests), and when
    creating/persisting many new entities, there is a very narrow
    window where the following exception could occur:
    org.apache.openjpa.persistence.EntityNotFoundException: The
    instance of type "class com.xxx.yyy.MyEntity"
    with oid "null" no longer exists in the data store. This may
    mean that you deleted the instance in a separate transaction,
    but this context still has a cached version.
    An EntityNotFoundException is a common exception which can
    occur when, as its name suggests, an entity is not found in
    the database.  In this particular case however, the
    EntityNotFoundException occurred only sporadically and in the
    case where only new entities were persisted, not removed as
    the exception message suggest.  The scenario under which the
    exception occurs is beyond the scope of this APAR and is
    extremely hard to get into.  To determine if this exception and
    message is applicable to this APAR, please ensure that you are
    not executing a find or query against an entity that doesn't
    exist.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to properly
    synchronize the suspect area of code which caused the
    erroneous EntityNotFoundException.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Level (Fix Pack) 8.5.5.9 of WebSphere
    Application Server version 8.5.5.
    
    Please refer to the recommended updates page for delivery
    information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI52209

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-11-09

  • Closed date

    2016-01-27

  • Last modified date

    2016-09-06

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R850 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
28 April 2022