I'm trying to configure Resin 3.1.9 to use Oracle Berkeley JE's JCA support
so that it can participate in Resin-managed XA transactions.  We now have
multiple Berkeley "Environments" (i.e. "databases") running in our app and
need to start ensuring we get atomicity across those environments.  Oracle
provides documentation and deployment descriptors for JBoss, SJAS, and
Oracle's servers, but no docs for Resin (sniffle).  

What I've done thus far ...

I've deployed Berkeley JE's RAR file successfully and see the following
message at startup:

[23:02:34.033] {main} ResourceArchive[Berkeley DB Java Edition JCA Adapter]
loaded

The part I'm stumbling through unsuccessfully is configuring the
resource/connection factory in web.xml so that I can then inject that
factory and use the factory to create connections to the "Environments" the
way Berkeley prescribes.  I've tried various combinations in an attempt to
figure out how resin interacts with Berkeley's implementation classes.

The first simple configuration I tried results in no exceptions, but the
result is simply an instance of  JEManagedConnectionFactory resident in the
WebBeansContainer and Resin makes no setup calls to the instance (e.g.
"JeMAnagedConnectionFactory.createConnectionFactory(ConnectionManager
cxManager)", for example).

<bean class="com.sleepycat.je.jca.ra.JEManagedConnectionFactory"
name="JEManagedConnectionFactory"/>

The next configuration attempt, which was inspired by the JCA tutorial at
http://www.caucho.com/resin-3.0/resource/tutorial/jca-connection/index.xtp,
creates a JEManagedConnectionFactory instance and Resin calls
createManagedConnection(Subject subject, ConnectionRequestInfo info) with
null passed to the ConnectionRequestInfo parameter:

<resource jndi-name="JEManagedConnectionFactory">
    <type>com.sleepycat.je.jca.ra.JEManagedConnectionFactory</type>
</resource>

I then tried using the database tags to prep the connection factory:

    <database>
        <xa>true</xa>
        <driver>
            <type>com.sleepycat.je.jca.ra.JEManagedConnectionFactory</type>
        </driver>
    </database>

In this variation, Resin calls
JEManagedConnectionFactory's.createConnectionFactory(ConnectionManager
cxManager) method, which seems like progress, but then Resin tosses
"java.lang.ClassCastException:
com.sleepycat.je.jca.ra.JEConnectionFactoryImpl
cannot be cast to javax.sql.DataSource".  I thought from the 3.1
documentation the <database> tag would detect if the driver type was a JCA
instance and set things up properly, so it's probable that I'm missing a key
attribute that tells Resin this isn't a DataSource.

The Resin JCA tutorial and classes there seem to line up well with
Berkeley's
ManagedConnectionFactory/ManagedConnection/ConnectionFactory/ConnectionFactoryImpl
implementation classes, but I've not been successful construction the proper
incantation to create the proper resin spell.

Is it possible in Resin 3.1.9 to set up a JCA resource that isn't a
DataSource? Ideas as to which <bean> or <resource> (or
<connection-factory>,<resource-adapter>,etc.) combination to use?  

The JCA tutorials use the <resource> tags, but reading the 3.1 docs my
understanding is that we should use <bean> tags instead.  However, <bean>
tags don't seem to result in calls to the setup methods of the
ManageConnectionFactory (e.g. createConnectionFactory).  Ideas greatly
appreciated!

Here's Berkeley's ra.xml file if it is of any help:

<connector>
   <display-name>Berkeley DB Java Edition JCA Adapter</display-name>
   <vendor-name>Oracle</vendor-name>
   <spec-version>1.0</spec-version>
   <eis-type>Database</eis-type>
   <version>2.0</version>
   <license>
      <description>
      Berkeley DB Java Edition; license may be required for redistribution.
      </description>
      <license-required>true</license-required>
   </license>
   <resourceadapter>
     
<managedconnectionfactory-class>com.sleepycat.je.jca.ra.JEManagedConnectionFactory
      </managedconnectionfactory-class>
     
<connectionfactory-interface>com.sleepycat.je.jca.ra.JEConnectionFactory
      </connectionfactory-interface>
     
<connectionfactory-impl-class>com.sleepycat.je.jca.ra.JEConnectionFactoryImpl
      </connectionfactory-impl-class>
      <connection-interface>com.sleepycat.je.jca.ra.JEConnection
      </connection-interface>
      <connection-impl-class>com.sleepycat.je.jca.ra.JEConnectionImpl
      </connection-impl-class>
      <!--
      <transaction-support>LocalTransaction</transaction-support>
      <transaction-support>NoTransaction</transaction-support>
      -->
      <transaction-support>XATransaction</transaction-support>
      <config-property>
         <config-property-name>UserName</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
         <config-property-value></config-property-value>
      </config-property>
      <config-property>
         <config-property-name>Password</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
         <config-property-value></config-property-value>
      </config-property>
      <authentication-mechanism>
        
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
        
<credential-interface>javax.resource.security.PasswordCredential</credential-interface>
      </authentication-mechanism>
      <reauthentication-support>true</reauthentication-support>
      <security-permission>
         <description>Read/Write access is required to the contents of
         the JERootDir</description>
         <security-permission-spec>permission java.io.FilePermission
         "/tmp/je_store/*", "read,write";</security-permission-spec>
      </security-permission>
   </resourceadapter>
</connector>


-tyson
-- 
View this message in context: 
http://www.nabble.com/Setting-up-Oracle-Berkeley-JE-and-XA-Transactions-via-JCA-%28Resin-3.1.9%29-tp24047537p24047537.html
Sent from the Resin mailing list archive at Nabble.com.



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to