3 Replies Latest reply on Jan 21, 2003 2:51 AM by Bernd Zeitler

    Commit problem in session bean using CMT

    Ramesh Newbie

      Hi,
      I am using a session bean to insert data into oracle database. The insert works fine from the bean. No errors/exceptions are thrown. But when I try to view the data from oracle's sqlplus, the data does not show up there. As soon as I stop the jboss-server, the data shows up on sql-plus. Looks like the transaction manager is not committing the inserts. Any idea what I may be doing wrong. I have given below the system info. Any help is greatly appreciated.

      System Info:
      1. Using Oracle XA Connection
      2. Using Container Managed Transaction
      3. Jboss Version 3.0.4
      4. JDK 1.3
      5. Oracle 8.1

        • 1. Re: Commit problem in session bean using CMT
          Bernd Zeitler Expert

          Hi,
          some code would be nice:
          - how do you obtain the DB connection?
          - ejb-jar.xml and perhaps jboss.xml

          If you really want to use oracle XA with JBoss, you have to use at least JBoss 3.2 .

          Regards,
          Frito

          • 2. Re: Commit problem in session bean using CMT
            Ramesh Newbie

            Hi Frito,
            Thanks for getting back to me. The XA Connection is obtained by using JNDI lookup on a data source. Then insert is done using JDBC calls.

            Here is the code to get connection object:

            ---
            InitialContext ic = new InitialContext();
            DataSource ds = (DataSource)ic.lookup(jndiName);
            con = ds.getConnection();
            -----

            I have also pasted below, portions of oracle-xa-service.xml file.


            <!--hack-->
            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RA
            RDeployment,name=Minerva JDBC XATransaction ResourceAdapter
            <!--real attributes-->


            <config-property name="XADataSourceProperties"
            type="java.lang.String">URL=jdbc:oracle:thin:@m2.a1books.com:152
            1:a1b</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">a1e</config-property>
            <config-property name="Password"
            type="java.lang.String">a1e</config-property>
            <!--
            Do not try to set transaction isolation level here or you'll get
            java.sql.SQLException: ORA-01453: SET TRANSACTION must be first s
            tatement of transaction
            Read committed is a default isolation level for Oracle, so there
            is not real need to set it here. I'll take a look into it later .
            ..maybe.
            <config-property name="TransactionIsolation"
            type="java.lang.String">TRANSACTION_READ_COMMITTED</config-prope
            rty>
            -->


            DefaultDS


            Please let me know if you find anything wrong with the xml file or code.

            Thanks
            Ramesh

            • 3. Re: Commit problem in session bean using CMT
              Bernd Zeitler Expert

              Is your ejb-jar.xml ok? (The assembly descriptor describing the container transaction)

              Frito