I'm running a 3.0.4 system with an XA datasource configuration copied
from the oracle-xa-service.xml example.

My code is:

  InitialContext ic = new InitialContext();
  DataSource ds = ic.lookup("java:/XAExtensionDS");
  Connection con = ds.getConnection();


ds is of type JDBCDataSource which is not an implementation of XADataSource
so I cannot get an XAConnection. con is of typeOracleConnection which is not
an implementation of XAConnection  so I don't have anyway of getting the
XAResource that I need to enlist this connection into my transaction.

Shouldn't the datasource returned from the lookup be an XADataSource?

I am not a database person and am porting old code into jboss 3 where I am
trying to do it properly (the old code talked directly to the JDBC driver and got
it's own connections, no connection pool). I am assuming the code that wants the
XAConnection is the right way for doing this. 

The oracle-xa-service definition is as follows: (Note, there are two definitions
in the one file, one for localTX and the second one one for XA).

<?xml version="1.0" encoding="UTF-8"?>
<server>
    <!-- ==================================================================== -->
    <!-- ConnectionManager setup for Oracle dbs                               -->
    <!-- ==================================================================== -->
    <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" 
             name="jboss.jca:service=LocalTxCM,name=ExtensionDS">

        <depends optional-attribute-name="ManagedConnectionFactoryName">
            <!--embedded mbean-->
            <mbean code="org.jboss.resource.connectionmanager.RARDeployment" 
                  name="jboss.jca:service=LocalTxDS,name=ExtensionDS">

                <attribute name="JndiName">ExtensionDS</attribute>

                <attribute name="ManagedConnectionFactoryProperties">
                    <properties>
                        <config-property name="ConnectionURL" 
type="java.lang.String">jdbc:oracle:thin:@cartman.mel.ot:1521:CART</config-property>
                        <config-property name="DriverClass" 
type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
                        <config-property name="UserName" 
type="java.lang.String">TU30</config-property>
                        <config-property name="Password" 
type="java.lang.String">TU30</config-property>
                    </properties>

                </attribute>

                <!--Below here are advanced properties -->
                <!--hack-->
                <depends 
optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss 
LocalTransaction JDBC Wrapper</depends>
            </mbean>
        </depends>

        <depends optional-attribute-name="ManagedConnectionPool">
            <!--embedded mbean-->
            <mbean 
code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" 
                 name="jboss.jca:service=LocalTxPool,name=ExtensionDS">

                <attribute name="MinSize">0</attribute>
                <attribute name="MaxSize">50</attribute>
                <attribute name="BlockingTimeoutMillis">5000</attribute>
                <attribute name="IdleTimeoutMinutes">15</attribute>
               
                <attribute name="Criteria">ByContainer</attribute>
            </mbean>

        </depends>
        <depends 
optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
        
        <depends 
optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>

        <attribute name="TransactionManager">java:/TransactionManager</attribute>
        
        <!--make the rar deploy! hack till better deployment-->
        <depends>jboss.jca:service=RARDeployer</depends>

    </mbean>

    <!-- ==================================================================== -->
    <!-- ConnectionManager setup for xa oracle dbs                            -->
    <!-- ==================================================================== -->

    <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager" 
               name="jboss.jca:service=XATxCM,name=XAExtensionDS">

        <depends optional-attribute-name="ManagedConnectionFactoryName">
            <!--embedded mbean-->
            <mbean code="org.jboss.resource.connectionmanager.RARDeployment" 
                   name="jboss.jca:service=XATxDS,name=XAExtensionDS">
                <!--hack-->
                <depends 
optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva
 JDBC XATransaction ResourceAdapter</depends>

                <!--real attributes-->
                <attribute name="ManagedConnectionFactoryProperties">
                    <properties>
                        <config-property name="XADataSourceProperties" 
type="java.lang.String">URL=jdbc:oracle:thin:@cartman.mel.ot:1521:CART</config-property>
                        <config-property name="XADataSourceClass" 
type="java.lang.String">oracle.jdbc.xa.client.OracleXADataSource</config-property>
                        <!--set these only if you want only default logins, not 
through JAAS -->
                        <config-property name="UserName" 
type="java.lang.String">TU30</config-property>
                        <config-property name="Password" 
type="java.lang.String">TU30</config-property>
                    </properties>
                </attribute>
                <attribute name="JndiName">XAExtensionDS</attribute>
            </mbean>
        </depends>

        <depends optional-attribute-name="ManagedConnectionPool">
            <!--embedded mbean-->
            <mbean 
code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
                     name="jboss.jca:service=XATxPool,name=XAExtensionDS">

                <attribute name="MinSize">0</attribute>
                <attribute name="MaxSize">50</attribute>
                <attribute name="BlockingTimeoutMillis">5000</attribute>
                <attribute name="IdleTimeoutMinutes">15</attribute>
               
                <attribute name="Criteria">ByContainer</attribute>
            </mbean>
        </depends>
        <depends 
optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>

        <depends 
optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>

        <attribute name="TransactionManager">java:/TransactionManager</attribute>

        <!--make the rar deploy! hack till better deployment-->
        <depends>jboss.jca:service=RARDeployer</depends>

    </mbean>


</server>




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to