5 Replies Latest reply on Apr 25, 2003 9:56 AM by skely76

    getting Oracle-XA Datasource working

    skely76

      Hi guys,

      I'm using JBoss-3.0.4_tomcat-4.1.12 with Oracle 8.1.6. and I'm using oracle:thin driver. (classes12.jar)
      With this configuration, my JBoss works fine with OracleDS(Non-XA).

      I followed the following steps to configure XA Datasource:

      ** I edited the "Transactions" bit in conf\jboss-service.xml to be the following....


      true


      ** I set up XAOracleDS using oracle-xa-service.xml, the server started up fine and it even displayed the following in console.

      [OracleDS] Bound connection factory for resource adapter 'Minerva JDBC XATransaction ResourceAdapter' to JNDI name 'java:/OracleDS'

      But when I tried using the datasource from an entity bean, it threw the following exception.


      14:15:24,408 WARN [TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=scarpc1878//0, BranchQual=] errorCode=XAER_PROTO
      javax.transaction.xa.XAException
      at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:239)
      at org.jboss.tm.TxCapsule.startResource(TxCapsule.java:1232)
      at org.jboss.tm.TxCapsule.enlistResource(TxCapsule.java:726)
      at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:102)
      at org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.enlist(XATxConnectionManager.java:262)
      at org.jboss.resource.connectionmanager.XATxConnectionManager.managedConnectionReconnected(XATxConnectionManager.java:202)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:534)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
      at org.jboss.resource.adapter.jdbc.JDBCDataSource.getConnection(JDBCDataSource.java:110)
      at com.entity.xa.ejb.SampleBeanXA.getConnection(SampleBeanXA.java:320)
      at com.entity.xa.ejb.SampleBeanXA.ejbFindByPrimaryKey(SampleBeanXA.java:256)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:638)
      at org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:330)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:301)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:690)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1119)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:206)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      ........

      Is this because of the Oracle Driver.. I'm using classes12.jar.
      My oracle-xa-service.xml file looks like this...


      jboss.jca:service=RARDeployer

      <depends optional-attribute-name="ManagedConnectionFactoryName">

      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC XATransaction ResourceAdapter


      <config-property name="XADataSourceProperties" type="java.lang.String">URL=jdbc:oracle:thin:@193.15.17.156:1521:devdb</config-property>
      <config-property name="XADataSourceClass" type="java.lang.String">oracle.jdbc.xa.client.OracleXADataSource</config-property>
      <config-property name="UserName" type="java.lang.String">dev</config-property>
      <config-property name="Password" type="java.lang.String">dev</config-property>


      OracleDS



      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->

      0
      50
      5000
      15
      ByContainer


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


      Please give me suggestions if you have overcome this before.

      Thank you,
      Skely

        • 1. Re: getting Oracle-XA Datasource working
          frito

          HI,

          if you want to use oracle xa with jboss, you should use jboss 3.2.x, since this is the version with a wrapper for the oracle connection, needed for getting it to run properly (afaik, the wrapper was even backported to 3.0.7, so this should work, too).
          Use the xxx-ds.xml for configuration instead of the xxx-service.xml . And I recommend using the oracle driver for 9i.
          This combination is easy to configure and works for me (for now ;-)

          Greetings,

          Frito

          • 2. Re: getting Oracle-XA Datasource working
            skely76

            Hi Frito,

            As you recommended, I tried using jboss-3.2.0_tomcat-4.1.24 with oracle jdbc driver (ojdbc14_g.jar) for Oracle9i Release 2 (9.2.0.1). I'm using oracle-xa-ds.xml for configuring. This time, I get a different exception..

            11:47:02,974 INFO [TxConnectionManager] Could not enlist in transaction on entering meta-aware object!
            javax.transaction.SystemException: enlistResource failed
            at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:473)
            at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
            at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
            at com.entity.xa.ejb.SampleBeanXA.getConnection(SampleBeanXA.java:319)
            at com.entity.xa.ejb.SampleBeanXA.ejbFindByPrimaryKey(SampleBeanXA.java:255)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            I dont know what this means.. any ideas???

            Cheers,
            Skely

            • 3. Re: getting Oracle-XA Datasource working
              skely76

              Hi,

              I followed these steps to configure Jboss 3.2.x with XAOracleDS. Please tell me if I have missed out on any important things.

              1) edited "oracle-xa-ds.xml" to point to my db in the following manner.


              <xa-datasource>
              <jndi-name>XAOracleDS</jndi-name>
              <track-connection-by-tx>true</track-connection-by-tx>
              <isSameRM-override-value>false</isSameRM-override-value>
              <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
              <xa-datasource-property name="URL">jdbc:oracle:thin:@193.14.16.150:1521:clipper</xa-datasource-property>
              <xa-datasource-property name="User">dev</xa-datasource-property>
              <xa-datasource-property name="Password">dev</xa-datasource-property>
              <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
              </xa-datasource>


              2) Modified conf\standardjaws.xml to append XAOracleDS

              java:/XAOracleDS
              <type-mapping>Oracle8</type-mapping>

              3) I placed classes12.jar in serverroot\lib directory.

              4) Modified transaction-service.xml to have


              true


              JBoss starts up with no complain. But when I try to get Connection from an Entity Bean, the following error shows:

              14:24:10,130 INFO [TxConnectionManager] Could not enlist in transaction on entering meta-aware object!
              javax.transaction.SystemException: enlistResource failed
              at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:473)
              at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
              at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
              at com.entity.xa.ejb.SampleBeanXA.getConnection(SampleBeanXA.java:319)
              at com.entity.xa.ejb.SampleBeanXA.ejbFindByPrimaryKey(SampleBeanXA.java:255)
              at java.lang.reflect.Method.invoke(Native Method)
              at org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:578)
              at org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:316)
              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:301)
              at org.jboss.ejb.EntityContainer.find(EntityContainer.java:685)
              at java.lang.reflect.Method.invoke(Native Method)
              at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998)
              at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188)

              Please suggest me if I'm doing anything wrong.
              I'm using jboss-3.2.0_tomcat-4.1.24 with Oracle 8.1.6 database on JDK1.3.1_07

              Do I need to do anything explicitly on the Oracle Database to support Transactions.

              Thankyou,
              Skely

              • 4. Re: getting Oracle-XA Datasource working
                skely76

                Hi,

                I followed these steps to configure Jboss 3.2.x with XAOracleDS. Please tell me if I have missed out on any important things.

                1) edited "oracle-xa-ds.xml" to point to my db in the following manner.


                <xa-datasource>
                <jndi-name>XAOracleDS</jndi-name>
                <track-connection-by-tx>true</track-connection-by-tx>
                <isSameRM-override-value>false</isSameRM-override-value>
                <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                <xa-datasource-property name="URL">jdbc:oracle:thin:@193.14.16.150:1521:clipper</xa-datasource-property>
                <xa-datasource-property name="User">dev</xa-datasource-property>
                <xa-datasource-property name="Password">dev</xa-datasource-property>
                <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
                </xa-datasource>


                2) Modified conf\standardjaws.xml to append XAOracleDS

                java:/XAOracleDS
                <type-mapping>Oracle8</type-mapping>

                3) I placed classes12.jar in serverroot\lib directory.

                4) Modified transaction-service.xml to have


                true


                JBoss starts up with no complain. But when I try to get Connection from an Entity Bean, the following error shows:

                14:24:10,130 INFO [TxConnectionManager] Could not enlist in transaction on entering meta-aware object!
                javax.transaction.SystemException: enlistResource failed
                at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:473)
                at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
                at com.entity.xa.ejb.SampleBeanXA.getConnection(SampleBeanXA.java:319)
                at com.entity.xa.ejb.SampleBeanXA.ejbFindByPrimaryKey(SampleBeanXA.java:255)
                at java.lang.reflect.Method.invoke(Native Method)
                at org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:578)
                at org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:316)
                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:301)
                at org.jboss.ejb.EntityContainer.find(EntityContainer.java:685)
                at java.lang.reflect.Method.invoke(Native Method)
                at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998)
                at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188)

                Please suggest me if I'm doing anything wrong.
                I'm using jboss-3.2.0_tomcat-4.1.24 with Oracle 8.1.6 database on JDK1.3.1_07

                Do I need to do anything explicitly on the Oracle Database to support Transactions.

                Thankyou,
                Sandy

                • 5. Re: getting Oracle-XA Datasource working
                  skely76

                  Hi Frito,

                  I tried using jboss3.2.x with oracle 9i driver. I got a different exception this time.. Could you please send me the Oracle driver to my email by attachment. Also, it will be nice if you send me the configuration steps you went through and the configuration files over. My email address is m.prabhu@pindar.com.

                  Thanks in advance,
                  Magesh

                  > HI,
                  >
                  > if you want to use oracle xa with jboss, you should
                  > use jboss 3.2.x, since this is the version with a
                  > wrapper for the oracle connection, needed for getting
                  > it to run properly (afaik, the wrapper was even
                  > backported to 3.0.7, so this should work, too).
                  > Use the xxx-ds.xml for configuration instead of the
                  > xxx-service.xml . And I recommend using the oracle
                  > driver for 9i.
                  > This combination is easy to configure and works for
                  > me (for now ;-)
                  >
                  > Greetings,
                  >
                  > Frito