Bug 1157649

Summary: [GSS](6.4.z) With Multiple JDBC Driver Versions, the Wrong Driver is Used
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: gbonocor
Component: JCAAssignee: Enrique Gonzalez Martinez <egonzale>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2.2CC: bmaxwell, cdewolf, gbonocor, jawilson, jolee, jpederse, lgao, ochaloup
Target Milestone: CR1Keywords: Reopened
Target Release: EAP 6.4.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-30 13:52:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1208206, 1219165    
Attachments:
Description Flags
module.xml none

Description gbonocor 2014-10-27 12:21:24 UTC
Created attachment 950974 [details]
module.xml

Description of problem:


In a multiple JDBC modules setup (2 different versions of Oracle driver), wrong driver version is picked

Version-Release number of selected component (if applicable):


How reproducible:

Modules have been created manually (see oracle.zip, attached, with module.xml)
Then drivers are added like follows:


/profile=full/subsystem=datasources/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=oracle.jdbc,driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource)

/profile=full/subsystem=datasources/jdbc-driver=oracle11.1:add(driver-name=oracle11.1,driver-module-name=oracle.jdbc,driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource,module-slot=11.1)

Then DS are created like follows:

/profile=full/subsystem=datasources/data-source=CHAT_DS:add(driver-name="oracle",connection-url="jdbc:oracle:thin:@//xyz:1521/REGIST_LB_DEFAULT",jndi-name="java:jboss/datasources/CHAT_DS",security-domain="CHAT_DS-SEC-ID",new-connection-sql="SELECT current_timestamp FROM dual",min-pool-size=1,max-pool-size=32,check-valid-connection-sql="SELECT current_timestamp FROM dual")

/profile=full/subsystem=datasources/data-source=ADT_DS:add(driver-name="oracle11.1",connection-url="jdbc:oracle:thin:@//xyz:1521/RESICST_LB_DEFAULT",jndi-name="java:jboss/datasources/ADT_DS",security-domain="ADT_DS-SEC-ID",new-connection-sql="SELECT current_timestamp FROM dual",min-pool-size=1,max-pool-size=32,check-valid-connection-sql="SELECT current_timestamp FROM dual")

The debug statements showed the version 11.2.0.3 is used and not 11.1.0.7 as expected . 


Steps to Reproduce:
1.
2.
3.

Actual results:

version 11.2.0.3 is used and not 11.1.0.7 as expected . 

Expected results:

version 11.1.0.7 used

Additional info:

Comment 1 gbonocor 2014-10-28 11:47:26 UTC
The customer identify the driver used with a snippet similar to:

 DatabaseMetaData meta = datasource.getConnection().getMetaData();
            logger.info(msg + ": JDBC driver version is [" + meta.getDriverVersion() + "]");

Comment 2 tom.jenkinson 2014-11-04 11:36:07 UTC
Does this have something to do with JPA? It doesn't appear to but does have the JPA component marked on it..

Comment 3 Enrique Gonzalez Martinez 2015-03-11 11:54:47 UTC
The problem in this case is located in
org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory::getDriver

In this case the class driver is cached with the same string "jdbc:mysql". This cache is shared among every mcf (the field LocalManagedConnectionFactory::driverCache  is static ). 

https://github.com/ironjacamar/ironjacamar/blob/ironjacamar-1.0.31.Final/adapters/src/main/java/org/jboss/jca/adapters/jdbc/local/LocalManagedConnectionFactory.java#L85

This makes not possible to use different versions of the same driver despite they belong to different datasources.

Comment 4 JBoss JIRA Server 2015-03-11 14:22:24 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1253 to Closed

Comment 5 Jesper Pedersen 2015-03-11 14:23:17 UTC
Blame JDK - use DataSource

Comment 8 Enrique Gonzalez Martinez 2015-04-08 10:14:12 UTC
I know this one is closed already. This issue has a pr merged already.

https://github.com/ironjacamar/ironjacamar/pull/316

Comment 9 JBoss JIRA Server 2015-04-08 15:36:26 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1258 to Resolved

Comment 10 Carlo de Wolf 2015-04-13 09:50:33 UTC
Removing the cache functionality fixes this problem.

Comment 11 JBoss JIRA Server 2015-04-14 14:27:07 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1258 to Closed

Comment 12 JBoss JIRA Server 2015-04-17 11:58:08 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1258 to Reopened

Comment 13 JBoss JIRA Server 2015-04-17 11:58:20 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1258 to Closed

Comment 15 Enrique Gonzalez Martinez 2015-04-20 09:35:42 UTC
This is already merged. Changing the status to MODIFIED.

PR for 1.0.x
https://github.com/ironjacamar/ironjacamar/pull/327

Comment 17 Martin Simka 2015-06-22 11:31:59 UTC
verified
EAP 6.4.2.CP.CR1

Comment 18 Petr Penicka 2017-01-17 10:18:45 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 19 Petr Penicka 2017-01-17 10:18:46 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 20 Petr Penicka 2017-01-17 10:18:53 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.