IBM Support

PI78643: Eclipselink JPA/Auditing capability in EE Environment fails withJNDI name parameter type

Fixes are available

9.0.0.4: WebSphere Application Server traditional V9.0 Fix Pack 4
9.0.0.5: WebSphere Application Server traditional V9.0 Fix Pack 5
9.0.0.6: WebSphere Application Server traditional V9.0 Fix Pack 6
9.0.0.7: WebSphere Application Server traditional V9.0 Fix Pack 7
17.0.0.2: WebSphere Application Server Liberty 17.0.0.2
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
9.0.0.8: WebSphere Application Server traditional V9.0 Fix Pack 8
9.0.0.9: WebSphere Application Server traditional V9.0 Fix Pack 9
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
9.0.0.10: WebSphere Application Server traditional V9.0 Fix Pack 10
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
9.0.0.11: WebSphere Application Server traditional V9.0 Fix Pack 11
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
9.0.5.0: WebSphere Application Server traditional Version 9.0.5 Refresh Pack
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
9.0.5.1: WebSphere Application Server traditional Version 9.0.5 Fix Pack 1
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
9.0.5.2: WebSphere Application Server traditional Version 9.0.5 Fix Pack 2
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
9.0.5.3: WebSphere Application Server traditional Version 9.0.5 Fix Pack 3
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • As described in eclipselink bug tracker entry at
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=512255 :
    
    As documented by the Eclipselink wiki, the Auditing
    capability can be used in the EE environment:
    
    https://wiki.eclipse.org/EclipseLink/Examples/JPA/Auditing#J
    ava_EE_and_JTA
    
    I have found that the feature works when a DataSource object
    is passed in as the value for the
    "javax.persistence.jtaDataSource" property, it does not work
    when the value is a String containing the JNDI name of the
    DataSource that the EntityManager is supposed to use instead
    of the persistence unit's regularly configured DataSource.
    
    The problem is part an incomplete implementation of the
    replacement ConnectionPolicy in
    EntityManagerImpl.createConnectionPolicy().  In the
    following block:
    
                   } else if (isNewDataSourceRequired != null) {
    JNDIConnector jndiConnector = (JNDIConnector)
    newLogin.getConnector();
                        if (isNewDataSourceRequired) {
                            if (dataSource != null) {
                        jndiConnector.setDataSource(dataSource);
                            } else {
                                // dataSourceName != null
                          jndiConnector.setName(dataSourceName);
                            }
                        }
                    }
    
    The JNDIConnector, a clone of the original, contains a
    DataSource reference to the persistence unit's reference to
    the DataSource.  If the property value is a DataSource, the
    JNDIConnector is updated to reference the new DataSource,
    which is used with JNDIConnector.connect().
    
    However, if the property value is a String, the JNDI name is
    passed to the JNDIConnector via setName(), but the
    JNDIConnector retains a reference to the regular DataSource
    - which JNDIConnector.connect() will readily use.
    JNDIConnector's dataSource reference must be set to null to
    signal it to perform a new JNDI lookup for the new
    DataSource referenced by the override property.
    
    The correction is simple, when setting the JNDIConnector's
    new JNDI name, set the datasource reference it holds to
    null, which effectively invalidates the old value and forces
    a lookup when connect() is invoked.
    
                   } else if (isNewDataSourceRequired != null) {
    JNDIConnector jndiConnector = (JNDIConnector)
    newLogin.getConnector();
                        if (isNewDataSourceRequired) {
                            if (dataSource != null) {
                        jndiConnector.setDataSource(dataSource);
                            } else {
                                // dataSourceName != null
                              jndiConnector.setDataSource(null);
                          jndiConnector.setName(dataSourceName);
                            }
                        }
                    }
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty - Java Persistence API       *
    *                  (JPA)                                       *
    ****************************************************************
    * PROBLEM DESCRIPTION: Eclipselink's auditing capability fails *
    *                      to use the                              *
    *                      "javax.persistence.jtaDataSource" when  *
    *                      provided as a JNDI name                 *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Eclipselink's auditing capability relies on the use of the
    "javax.persistence.jtaDataSource" or
    "javax.persistence.nonJtaDataSource" properties to define the
    alternate DataSource to use when provided as arguments to the
    EntityManagerFactory.createEntityManager() method.  This feature
    works correctly when the value associated with the property is
    an instance of DataSource, but is ignored when the value is a
    String containing the JNDI name of the DataSource intended to be
    used.
    

Problem conclusion

  • Property processing for "javax.persistence.jtaDataSource" and
    "javax.persistence.nonJtaDataSource" has been fixed to properly
    manage being provided a JNDI name.
    
    The fix for this APAR is currently targeted for inclusion in fix
    pack 9.0.0.4 and Liberty 17.0.0.2.  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

    PI78643

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    855

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-03-22

  • Closed date

    2017-03-28

  • Last modified date

    2017-03-29

  • 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

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • R855 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"855","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
17 June 2020