WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

dataSource with containerAuthDataRef

  • 1.  dataSource with containerAuthDataRef

    Posted 08/02/18 02:13 AM
    ​Good Morning all,

    I have an issue in configuring a datasoruce element in IBM liberty v18.0.0.1 , when i configure the datasource element to use containerAuthDataRef to establish a connection instead of typing the user name and the password in the datasource element directly, i get an excepation during the server start up, any one can



    -- Oracle database configuration -->
     <!-- Please note that all below variables are defined in application_Config.xml
      in the xml_config folders -->
     <jdbcDriver id="Oracle_Driver"
      javax.sql.DataSource="oracle.jdbc.pool.OracleConnectionPoolDataSource">
      <library id="OracleJDBCLib">
       <fileset dir="${shared.resource.dir}/JavaJars" includes="ojdbc7.jar" />

      </library>
     </jdbcDriver>
     <dataSource id="Oracle_DataSource" jdbcDriverRef="Oracle_Driver"
      jndiName="${App.oracle.dataSource_JNDI_NAME}" type="javax.sql.ConnectionPoolDataSource"
      containerAuthDataRef="Oracle_db_Authen_Ref" jaasLoginContextEntryRef="Oracle_db_Authen_Ref">
      <properties.oracle URL="${App.oracle.dataSource_url}" beginTranForResultSetScrollingAPIs="false" beginTranForVendorAPIs="false"
       connectionSharing="1" databaseName="${App.oracle.dataSource_DB_Schema}"
       enableMultithreadedAccessDetection="false" errorDetectionModel="ExceptionMapping"
       freeResourcesOnClose="false" jmsOnePhaseOptimization="false"
       name="${App.oracle.dataSource_Name}" nonTransactionalDataSource="false"
       oracleLogFileCount="1" oracleLogFileSizeLimit="0" oracleLogFormat="SimpleFormat"
       oracleLogPackageName="oracle.jdbc.driver" oracleLogTraceLevel="INFO"
       portNumber="${App.oracle.dataSource_port}" preTestSQLString="SELECT 1 FROM DUAL"
       reauthentication="false" serverName="${App.oracle.dataSource_Server_Name}"
       validateNewConnection="false" validateNewConnectionRetryCount="100"
       validateNewConnectionRetryInterval="3" />
      <connectionManager agedTimeout="0"
       connectionTimeout="180" maxIdleTime="1800"
       maxPoolSize="${App.oracle.dataSource_maxPoolSize}" minPoolSize="1"
       reapTime="180" />
        
        </dataSource> 

     <authData user="${App.oracle.dataSource_user}" password="${app.db.oracle.password}" id="Oracle_db_Authen_Ref"></authData>

    </server>


    ERROR   ] J2CA0046E: Method createManagedConnectionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/foo/sfp/oracle, throwing ResourceAllocationException. Original exception: <=================================>Exception Message -> null
    java.lang.NullPointerException
     at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
     at com.ibm.ws.rsadapter.impl.DatabaseHelper$1.run(DatabaseHelper.java:949)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.ibm.ws.rsadapter.impl.DatabaseHelper.getPooledConnection(DatabaseHelper.java:958)
     at com.ibm.ws.rsadapter.impl.WSManagedConnectionFactoryImpl.getConnection(WSManagedConnectionFactoryImpl.java:792)
     at com.ibm.ws.rsadapter.impl.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:649)
     at com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1354)
     at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1228)
     at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:1434)
     at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:573)
     at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:309)
     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:143)
     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:116)
     at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
     at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
     at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
     at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
     at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
     at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:533)
     at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:458)
     at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:121)
     at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
     at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
     at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967)
     at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958)
     at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:283)
     at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:267)
     at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:169)
     at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
     at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:910)
     at com.ibm.ws.jpa.management.JPAPUnitInfo.initialize(JPAPUnitInfo.java:762)
     at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:190)
     at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:90)
     at com.ibm.ws.jpa.management.JPAApplInfo.addPersistenceUnits(JPAApplInfo.java:118)
     at com.ibm.ws.jpa.container.osgi.internal.JPAComponentImpl.processLibraryJarPersistenceXml(JPAComponentImpl.java:425)
     at com.ibm.ws.jpa.container.osgi.internal.JPAComponentImpl.applicationStarting(JPAComponentImpl.java:221)

    ------------------------------
    Omar Adel
    ------------------------------