On Jun 15, 2009, at 9:36 PM, tweihs wrote:
>
> 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).
I've added a bug report to check into this. The full-custom JCA
configuration in Resin needs a cleanup (e.g. integration with CanDI
and upgrade to JCA 1.6). Some notes below.
>
> 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
This just means it's stored internally. For full JCA configuration,
you can use Resin's <connector> configuration, although I think it
expects a resource-adapter class.
>
> 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"/>
Unfortunately, <bean> doesn't know about JCA. It's just a straight
instantiation of the class, so it wouldn't create the connection
factory properly.
The <resource> should hook into JCA.
> 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>
That sounds like a bug in Resin. <resource> should know about JCA.
> 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>
This should work if the JCA connection factory is a JDBC driver. It
sounds like it's a custom interface, so it won't match.
>
>
> 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 full configuration should be the <connector> and <connection-
factory> (in this specific example, <resource> should also work.)
(I'll need to look at this later. It's been awhile since I've looked
at JCA.)
-- Scott
> 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
> [email protected]
> http://maillist.caucho.com/mailman/listinfo/resin-interest
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest