1 Reply Latest reply on Dec 20, 2005 5:40 PM by atulksh

    transaction not committed after ejbCreate

    atulksh

      Hi,
      I am using JBoss 4.02 with Oracle 91 (XA datasource). I have a BMP EJB. I can see that after I create a new instance (ejbCreate called) a record gets inserted in the db - since there is not exception thrown. But the transaction does not get committed. For that reason the record does not get reflected in future queries (or even from outside the application server). But if I shut down JBoss server then the records appear - meaning the data gets comitted.

      Why does this occur? Shouldn't the container commit the transaction immediately after the ejbCreate return?

      Thanks for your response in advance.

      Atul.

        • 1. Re: transaction not committed after ejbCreate
          atulksh

          Okay. I have found how to resolve my issue. The original issue still remains.

          I had followed the jboss official documentation to setup the Oracle 9i data source. This tells to setup an xa datasource.

          http://docs.jboss.org/jbossas/getting_started/v4/html/db.html

          This was giving me the issue. My EJBs could write the data to the db but the transaction was not comitted by the container and the data was not reflected until I stop the server wherein all commits would seemingly be done and the data became visible. The data was not visible even to other ejbs in the application when the server was running.

          Then I thought of trying the normal datasource. So I followd the documentation on the wiki to setup a regular datasource.

          http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAOracleDatasource

          And viola my application started to run fine.

          So the issue still remains why does the xa datasource behave that way? Am I missing some configuration that I need to do to tell it to commit?

          If anybody ever finds it out please do reply. For reference I am giving both ot the blocks of my configuration.

          this one works ---

          <local-tx-datasource>
          <jndi-name>dbPool</jndi-name>
          <use-java-context>false</use-java-context>
          <connection-url>jdbc:oracle:thin:@dbserver:1521:schema</connection-url>
          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
          <user-name>user</user-name>
          pwd

          <min-pool-size>5</min-pool-size>
          <max-pool-size>20</max-pool-size>

          <!-- Checks the Oracle error codes and messages for fatal errors -->
          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

          <type-mapping>Oracle9i</type-mapping>

          </local-tx-datasource>


          this one does not ---

          <xa-datasource>
          <jndi-name>dbPool</jndi-name>
          <use-java-context>false</use-java-context>
          <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:@dbserver:1521:schema
          </xa-datasource-property>
          <xa-datasource-property name="User">user</xa-datasource-property>
          <xa-datasource-property name="Password">pwd</xa-datasource-property>
          <exception-sorter-class-name>
          org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
          </exception-sorter-class-name>
          <no-tx-separate-pools/>
          </xa-datasource>