Bug 807675 - Jdbc cache stores do not work with ManagedConnectionFactory in a transactional context
Jdbc cache stores do not work with ManagedConnectionFactory in a transactiona...
Status: CLOSED DUPLICATE of bug 807674
Product: JBoss Data Grid 6
Classification: JBoss
Component: Infinispan (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity high
: ---
: 6.1.0
Assigned To: Tristan Tarrant
:
Depends On: 758178
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-28 09:20 EDT by Tristan Tarrant
Modified: 2012-03-28 09:43 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 758178
Environment:
Last Closed: 2012-03-28 09:43:21 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)

  None (edit)
Description Tristan Tarrant 2012-03-28 09:20:56 EDT
+++ This bug was initially created as a clone of Bug #758178 +++

Description of problem:

This is probably related to https://issues.jboss.org/browse/ISPN-586.

When I configure a jdbc cache store without specifying connnectionFactoryClass, the ManagedConnectionFactory is used and it cannot acquire a connection to DB:

[java] 13:56:05,419 ERROR [org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory] (MemcachedServerWorker-2-1) ISPN008018: Sql failure retrieving connection from datasource: java.sql.SQLException: javax.resource.ResourceException: Error checking for a transaction...

...the whole exception attached

On the other hand, I was able to connect to the database with SimpleConnectionFactory but this is not usable in production environment.




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

EDG Snapshot from 2011-11-25 (contains JBoss AS 7.1.0.Beta1 "Tesla" and Infinispan 5.1.0-SNAPSHOT)


How reproducible:

Store a cache entry to a cache defined with jdbc-store configuration attached, datasources subsystem configuration attached as well.

As I said, I was able to store a key to the cache store when using SimpleConnectionFactory. I needed to do a few configuration changes, though:

I needed to add the following properties to jdbc-store:

<property name="connectionFactoryClass">org.infinispan.loaders.jdbc.connectionfactory.SimpleConnectionFactory</property>
<property name="driverClass">org.h2.jdbcx.JdbcDataSource</property>
<property name="connectionUrl">jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</property>
<property name="userName">sa</property>

datasources subsystem looked like this:

<datasources>
                <datasource jndi-name="java:jboss/datasources/JdbcDS" enabled="true" use-java-context="true"
                             pool-name="java:jboss/datasources/JdbcDS">
                     <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                     <driver>h2</driver>
                     <pool></pool>
                     <security>
                         <user-name>sa</user-name>
                         <password>sa</password>
                     </security>
                 </datasource>
                 <drivers>
                     <driver name="h2" module="com.h2database.h2">
                         <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                     </driver>
                 </drivers>
             </datasources>

Another thing that was needed was to add <module name="com.h2database.h2" export="true"/> to ${EDG_HOME}/modules/org/infinispan/cachestore/jdbc/main/module.xml

--- Additional comment from mgencur@redhat.com on 2011-11-29 14:24:16 CET ---

Created attachment 537984 [details]
Exception thrown

--- Additional comment from mgencur@redhat.com on 2011-11-29 14:25:09 CET ---

Created attachment 537985 [details]
Configs for reproducing the bug

--- Additional comment from mgencur@redhat.com on 2012-02-10 10:52:01 CET ---

Just FYI: I created AS7-3674 since I thought it was another problem but it turned out to be the same issue as ISPN-604. So this bug is dependent on AS7-3674 which should be automatically fixed once ISPN-604 is implemented and this change gets into Infinispan subsystem of AS7.

--- Additional comment from pjha@redhat.com on 2012-03-05 05:03:17 CET ---

Tristan, is this going to be fixed in ER03 i.e before limited availability release?

--- Additional comment from ttarrant@redhat.com on 2012-03-05 10:05:10 CET ---

Highly unlikely unfortunately

--- Additional comment from mhusnain@redhat.com on 2012-03-23 03:19:50 CET ---

The technical_notes? flag indicates that this is a known issue. Please add summarized cause (what caused the issue) and consequence (how the issue manifests) information about this in the Technical Notes field.

--- Additional comment from ttarrant@redhat.com on 2012-03-26 10:45:06 CEST ---

Created attachment 572707 [details]
JDG 6.0.0.ER5 + transactional datasource hack

This JAR is identical to the distributed JDG 6.0.0.ER5 JAR with the addition of Mircea's hack to workaround the issue of using a transactional datasource with a cachestore

--- Additional comment from gsheldon@redhat.com on 2012-03-28 03:42:02 CEST ---


    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:When the JDBC Cache Store is configured without specifying connnectionFactoryClass, the ManagedConnectionFactory is selected by default.
Consequence: ManagedConnectionFactory is unable to connect to the database.
Fix: None
Result: Specify connnectionFactoryClass in jdbc cache store prior to attempting a transaction. Failure to do so will result in a connection error via the ManagedConnectionFactory.

--- Additional comment from mhusnain@redhat.com on 2012-03-28 03:44:18 CEST ---


    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,4 +1,4 @@
 Cause:When the JDBC Cache Store is configured without specifying connnectionFactoryClass, the ManagedConnectionFactory is selected by default.
 Consequence: ManagedConnectionFactory is unable to connect to the database.
 Fix: None
-Result: Specify connnectionFactoryClass in jdbc cache store prior to attempting a transaction. Failure to do so will result in a connection error via the ManagedConnectionFactory.+Result: None

--- Additional comment from myarboro@redhat.com on 2012-03-28 15:13:22 CEST ---

Tristan indicates that ER6 will contain a work around in the code.
Comment 1 Tristan Tarrant 2012-03-28 09:21:29 EDT
This will be fixed properly in JDG 7
Comment 2 Tristan Tarrant 2012-03-28 09:43:21 EDT

*** This bug has been marked as a duplicate of bug 807674 ***

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