0 Replies Latest reply on Dec 10, 2003 4:13 PM by craigpardey

    Db transactions not working in 3.0.6.

    craigpardey

      Hi,

      I have been trying to use container managed transactions in JBoss 3.0.6. and I can't seem to get it to rollback correctly. The database is Oracle 8.1.7. I am using a stateless session bean to create/update many entity beans. Updates are also done (in the same txn) using JDBC. All connections use the same datasource.

      Simply put, the database transactions never get rolled back. I have tried all of the following:


      * Container managed transactions, 'Required', and sessionContext.setRollbackOnly()
      * Container managed transactions, 'Required', and throwing an EJBException
      * Bean managed, userTransaction.rollback()


      Here is the datasource configuration file. For some reason, the forums are removing the 'attribute' tags from the file. Anyway, it should give you an idea.
       <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager"
       name="jboss.jca:service=LocalTxCM,name=CDSDataSource">
      
       <depends optional-attribute-name="ManagedConnectionFactoryName">
       <!--embedded mbean-->
       <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
       name="jboss.jca:service=LocalTxDS,name=CDSDataSource">
      
       <attribute name="JndiName">CDSDataSource</attribute>
       <attribute name="ManagedConnectionFactoryProperties">
       <properties>
       <config-property name="ConnectionURL" type="java.lang.String">
       jdbc:oracle:thin:@server:1521:db
       </config-property>
       <config-property name="DriverClass" type="java.lang.String">
       oracle.jdbc.driver.OracleDriver
       </config-property>
      
       <config-property name="UserName" type="java.lang.String">usenrame</config-property>
       <config-property name="Password" type="java.lang.String">pwd</config-property>
      
       </properties>
       </attribute>
      
       <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=CDSDataSource">
       <attribute name="MinSize">5</attribute>
       <attribute name="MaxSize">15</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>
      


      The database connection is retrieved as follows

       Context context = new InitialContext();
       m_source = (DataSource) context.lookup("java:/CDSDataSource");
       return m_source.getConnection();
      


      When I turned trace logging on for org.jboss.ejb.plugins, org.jboss.tm, and org.jboss.resource, there was no indication in the log file that a transaction was ever started.

      The connections coming out of the pool have autocommit set to true. I tried all the above configs using 3.0.8 and the only difference was that the connections came out of the pool with autocommit set to false. The transactions still weren't rolled back.

      Any help would be much appreciated.