Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-13990

[GSS](7.2.z) Oracle UCP uses TCCL to load JDBC driver's classes

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Out of Date
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JCA
    • Labels:

      Description

      THE CAUSE

      If you create a data source (or XA data source) which uses Oracle UCP and you have all required UCP jars (ucp.jar, ons.jar, ojdbc7.jar) in one static module, when trying to obtain a connection, UCP classes will try to find the JDBC driver's classes using TCCL rather than their own class loader.

      We consider this an issue in the UCP's classes on Oracle's side.
      We identified 3 different negative impacts of this misbehaviour.

      IMPACT 1 - ISSUE

      Because TCCL corresponds to the deployed application, UCP classes won't be able to find the JDBC driver, therefore the data source won't work and obtaining a connection will fail with

      java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager: java.sql.SQLException: Invalid Universal Connection Pool configuration: java.sql.SQLException: Unable to create factory class instance with provided factory class name: java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource from [Module "deployment.test.war:main" from Service Module Loader]
      	at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:488)
      	at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:163)
      	at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:654)
      	at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:922)
      	at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:873)
      	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:305)
      	... 152 more
      Caused by: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager: java.sql.SQLException: Invalid Universal Connection Pool configuration: java.sql.SQLException: Unable to create factory class instance with provided factory class name: java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource from [Module "deployment.test.war:main" from Service Module Loader]
      	at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:368)
      	at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:49)
      	at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:80)
      	at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl.createConnectionPool(UniversalConnectionPoolManagerMBeanImpl.java:317)
      	at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:631)
      	... 155 more
      
      

      IMPACT 1 - WORKAROUND

      There are two possible workarounds

      • declare the UCP's static module as global ( /subsystem=ee:write-attribute(name=global-modules, value=[ {name=com.oracle.ucp}

        ]) )

      • for the application which uses the data source, declare a dependency on the UCP's module

      After applying one of these workarounds, it will still not be possible to use :test-connection-in-pool management operation – for that, you need to add the dependency on the UCP module for the module org.jboss.as.connector (that's because when running the operation, the TCCL will be the class loader of org.jboss.as.connector module)

      IMPACT 2 - ISSUE

      Update: this is actually caused by JBEAP-3154, not a bug in UCP
      Specifically XA data sources won't work due to this additional issue:

          Caused by: java.lang.NoClassDefFoundError: javax/transaction/xa/XAResource  
                  at java.lang.Class.getDeclaredMethods0(Native Method)  
                  at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)  
                  at java.lang.Class.privateGetPublicMethods(Class.java:2902)  
                  at java.lang.Class.getMethods(Class.java:1615)  
                  at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:451)  
                  at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:339)  
                  at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:639)  
                  at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)  
                  at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)  
                  at java.lang.reflect.WeakCache.get(WeakCache.java:127)  
                  at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)  
                  at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)  
                  at oracle.ucp.jdbc.proxy.XAConnectionProxyFactory.createConnectionProxy(XAConnectionProxyFactory.java:78)  
                  at oracle.ucp.jdbc.PoolXADataSourceImpl.getXAConnection(PoolXADataSourceImpl.java:226)  
                  at oracle.ucp.jdbc.PoolXADataSourceImpl.getXAConnection(PoolXADataSourceImpl.java:170)  
                  at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:479)  
                  ... 40 more  
          Caused by: java.lang.ClassNotFoundException: javax.transaction.xa.XAResource from [Module "javax.sql.api:main" from local module loader @707f7052 (finder: local module finder @11028347 (roots: /home/msimka/Projekty/redhat/tmp/oracle_ucp/jboss-eap-7.0/modules,/home/msimka/Projekty/redhat/tmp/oracle_ucp/jboss-eap-7.0/modules/system/layers/base))]  
                  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)  
                  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)  
                  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)  
                  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)  
                  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)  
                  ... 56 more  
      

      IMPACT 2 - WORKAROUND

      Add dependency <module name="javax.transaction.api"/> to javax.sql.api module. This breaks patching mechanism!

      IMPACT 3 - ISSUE

      Even if both above mentioned workarouds are deployed, UCP's misbehavior also causes transaction recovery to not work, because XA connection is attempted when org.jboss.jts's class loader is the TCCL

      14:50:10,086 ERROR [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) IJ000906: Error during crash recovery: java:jboss/datasources/OracleUCPDS (IJ031084: Unable to create connection): javax.resource.ResourceException: IJ031084: Unable to create connection  
              at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:496)  
              at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory$1.run(XAManagedConnectionFactory.java:392)  
              at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory$1.run(XAManagedConnectionFactory.java:389)  
              at java.security.AccessController.doPrivileged(Native Method)  
              at javax.security.auth.Subject.doAs(Subject.java:422)  
              at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:388)  
              at org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.open(XAResourceRecoveryImpl.java:355)  
              at org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.getXAResources(XAResourceRecoveryImpl.java:193)  
              at com.arjuna.ats.internal.jbossatx.jta.XAResourceRecoveryHelperWrapper.getXAResources(XAResourceRecoveryHelperWrapper.java:51)  
              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:517)  
              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkFirstPass(XARecoveryModule.java:183)  
              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:747)  
              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:375)  
      Caused by: java.lang.IllegalArgumentException: interface oracle.ucp.jdbc.ValidConnection is not visible from class loader  
              at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)  
              at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)  
              at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)  
              at java.lang.reflect.WeakCache.get(WeakCache.java:127)  
              at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)  
              at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)  
              at oracle.ucp.jdbc.proxy.XAConnectionProxyFactory.createConnectionProxy(XAConnectionProxyFactory.java:78)  
              at oracle.ucp.jdbc.PoolXADataSourceImpl.getXAConnection(PoolXADataSourceImpl.java:226)  
              at oracle.ucp.jdbc.PoolXADataSourceImpl.getXAConnection(PoolXADataSourceImpl.java:170)  
              at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:479)  
      

      IMPACT 3 - WORKAROUND

      Add dependency on the UCP module for org.jboss.jts module - this breaks the patching mechanism!!!

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  simkam Martin Simka
                  Reporter:
                  bmaxwell Brad Maxwell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: