Bug 1157649 - [GSS](6.4.z) With Multiple JDBC Driver Versions, the Wrong Driver is Used
[GSS](6.4.z) With Multiple JDBC Driver Versions, the Wrong Driver is Used
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JCA (Show other bugs)
6.2.2
Unspecified Unspecified
unspecified Severity unspecified
: CR1
: EAP 6.4.2
Assigned To: Enrique Gonzalez Martinez
Martin Simka
: Reopened
Depends On:
Blocks: 1208206 1219165
  Show dependency treegraph
 
Reported: 2014-10-27 08:21 EDT by gbonocor
Modified: 2017-01-17 05:18 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-30 09:52:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
module.xml (1.48 KB, application/zip)
2014-10-27 08:21 EDT, gbonocor
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker JBJCA-1253 Major Closed Multiple JDBC drivers versions - wrong driver is used 2016-12-14 15:07 EST
JBoss Issue Tracker JBJCA-1258 Major Closed Remove driver cache 2017-08-17 02:11 EDT

  None (edit)
Description gbonocor 2014-10-27 08:21:24 EDT
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 07:47:26 EDT
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 06:36:07 EST
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 07:54:47 EDT
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 10:22:24 EDT
Jesper Pedersen <jpederse@redhat.com> updated the status of jira JBJCA-1253 to Closed
Comment 5 Jesper Pedersen 2015-03-11 10:23:17 EDT
Blame JDK - use DataSource
Comment 8 Enrique Gonzalez Martinez 2015-04-08 06:14:12 EDT
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 11:36:26 EDT
Jesper Pedersen <jpederse@redhat.com> updated the status of jira JBJCA-1258 to Resolved
Comment 10 Carlo de Wolf 2015-04-13 05:50:33 EDT
Removing the cache functionality fixes this problem.
Comment 11 JBoss JIRA Server 2015-04-14 10:27:07 EDT
Jesper Pedersen <jpederse@redhat.com> updated the status of jira JBJCA-1258 to Closed
Comment 12 JBoss JIRA Server 2015-04-17 07:58:08 EDT
Jesper Pedersen <jpederse@redhat.com> updated the status of jira JBJCA-1258 to Reopened
Comment 13 JBoss JIRA Server 2015-04-17 07:58:20 EDT
Jesper Pedersen <jpederse@redhat.com> updated the status of jira JBJCA-1258 to Closed
Comment 15 Enrique Gonzalez Martinez 2015-04-20 05:35:42 EDT
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 07:31:59 EDT
verified
EAP 6.4.2.CP.CR1
Comment 18 Petr Penicka 2017-01-17 05:18:45 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.
Comment 19 Petr Penicka 2017-01-17 05:18:46 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.
Comment 20 Petr Penicka 2017-01-17 05:18:53 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Note You need to log in before you can comment on or make changes to this bug.