Announcement Announcement Module
Collapse
No announcement yet.
Rollback exception overridden by synchronization exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rollback exception overridden by synchronization exception

    I am having trouble using a DataSourceTransactionManager in JBoss with Programmatic Transaction Demarcation.

    I am using a JNDI Datasource for which I then declares a DataSourceTransactionManager.

    In my program I execute a list of SQL statements one after the other I handle the transaction manualy via the above declared DataSourceTransactionManager. But I am getting a Exception :

    java.lang.IllegalStateException: Transaction synchronization is not active

    Code:
    ERROR [DataSourceTransactionManager] Rollback exception overridden by synchronization exception
    java.lang.IllegalStateException: Transaction synchronization is not active
            at org.springframework.transaction.support.TransactionSynchronizationManager.getSynchronizations(TransactionSynchronizationManager.java:220)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCompletion(AbstractPlatformTransactionManager.java:512)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:423)
    In my code I use :

    Code:
    TransactionStatus status =  transactionManager.getTransaction(transactionDefinition);
    
    .....some code
    
    transactionManager.commit(status);

    I understand the error - but why is the transaction not started...

    If I run the same code outside of JBoss - using a DBCP datasource all is fine - but if I run this setup in JBoss behind an MDB I have this problem...

    Is there any difference frm using a JNDI datasource in JBoss and a DBCP datasource other than the config ??? Anything I should bear in mind.

    I am Using Spring 1.1, JBoss 3.2.5 and Oracle - I upgraded from Spring 1.0.2 I thought it might fix the problem, but it didn't.

    Any ideas ??

    Thanks

    Andre

    A snippet from my config file :

    Code:
    <bean id="datasource" 
    		class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName">
    			<value>$&#123;datasource.name&#125;</value>
    		</property>
    </bean>
    	
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource">
                <ref bean="datasource"/>
            </property>
    </bean>
    
    
    <bean id="sqlBlockExecuter" 
    		class="com.scc.salt.core.sql.SpringSQLBlockExecuter">
    		
    		<property name="description">
    			<value>Partsloader process.</value>
    		</property>
    		<constructor-arg>
    			<ref bean="datasource"/>
    		</constructor-arg>		
    		
    		
    		<property name="transactionManager">
    			<ref bean="transactionManager"/>
    		</property>
    		
    		<property name="mainOperations">
    			<list>
    				<value>
    					statement 1
    				</value>
    				<value>
    					statement 2
    				</value>
    			</list>
    		</property>
    </bean>

  • #2
    Depending on your JBoss configuration, you could try using the JtaTransactionManager.

    Comment


    • #3
      If I change my TransctionManager to JTA as this :

      Code:
      <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" />
      I get an exception on a Vanilla JBoss 3.2.5 under running default.
      Again I can see why BUT all the current JtaTransactionManager examples I can get is not specifying any parameters.

      I need to figure out where JBoss store the UserTransaction.

      Any JBoss specific JTA examples avalable ?


      Exception I am getting.

      Code:
      13&#58;01&#58;01,632 ERROR &#91;JMSContainerInvoker&#93; Exception in JMSCI message listener
      javax.ejb.TransactionRolledbackLocalException&#58; null; CausedByException is&#58;
              Error creating bean with name 'transactionManager' defined in class path resource &#91;DatabaseConfig.xml&#93;&#58; Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemException&#58; JTA UserTransaction is not available at JNDI location &#91;java&#58;comp/UserTransact
      ion&#93;; nested exception is javax.naming.NameNotFoundException&#58; UserTransaction not bound; CausedByException is&#58;
              null; CausedByException is&#58;
              Error creating bean with name 'transactionManager' defined in class path resource &#91;DatabaseConfig.xml&#93;&#58; Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemException&#58; JTA UserTransaction is not available at JNDI location &#91;java&#58;comp/UserTransact
      ion&#93;; nested exception is javax.naming.NameNotFoundException&#58; UserTransaction not bound
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext&#40;AbstractTxInterceptor.java&#58;204&#41;
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions&#40;TxInterceptorCMT.java&#58;315&#41;
              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke&#40;TxInterceptorCMT.java&#58;148&#41;
              at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke&#40;RunAsSecurityInterceptor.java&#58;90&#41;
              at org.jboss.ejb.plugins.LogInterceptor.invoke&#40;LogInterceptor.java&#58;191&#41;
              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke&#40;ProxyFactoryFinderInterceptor.java&#58;122&#41;
              at org.jboss.ejb.MessageDrivenContainer.internalInvoke&#40;MessageDrivenContainer.java&#58;372&#41;
              at org.jboss.ejb.Container.invoke&#40;Container.java&#58;723&#41;
              at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke&#40;JMSContainerInvoker.java&#58;914&#41;
              at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage&#40;JMSContainerInvoker.java&#58;1208&#41;
              at org.jboss.jms.asf.StdServerSession.onMessage&#40;StdServerSession.java&#58;276&#41;
              at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage&#40;SpyMessageConsumer.java&#58;871&#41;
              at org.jboss.mq.SpyMessageConsumer.addMessage&#40;SpyMessageConsumer.java&#58;159&#41;
              at org.jboss.mq.SpySession.run&#40;SpySession.java&#58;347&#41;
              at org.jboss.jms.asf.StdServerSession.run0&#40;StdServerSession.java&#58;200&#41;
              at org.jboss.jms.asf.StdServerSession.run&#40;StdServerSession.java&#58;180&#41;
              at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run&#40;PooledExecutor.java&#58;748&#41;
              at java.lang.Thread.run&#40;Thread.java&#58;536&#41;
      javax.ejb.EJBException&#58; null; CausedByException is&#58;
              Error creating bean with name 'transactionManager' defined in class path resource &#91;DatabaseConfig.xml&#93;&#58; Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemException&#58; JTA UserTransaction is not available at JNDI location &#91;java&#58;comp/UserTransact
      ion&#93;; nested exception is javax.naming.NameNotFoundException&#58; UserTransaction not bound
              at org.jboss.ejb.MessageDrivenEnterpriseContext.<init>&#40;MessageDrivenEnterpriseContext.java&#58;78&#41;
              at org.jboss.ejb.plugins.MessageDrivenInstancePool.create&#40;MessageDrivenInstancePool.java&#58;36&#41;
              at org.jboss.ejb.plugins.AbstractInstancePool.get&#40;AbstractInstancePool.java&#58;168&#41;
              at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke&#40;MessageDrivenInstanceInterceptor.java&#58;48&#41;
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext&#40;AbstractTxInterceptor.java&#58;84&#41;
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions&#40;TxInterceptorCMT.java&#58;315&#41;
              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke&#40;TxInterceptorCMT.java&#58;148&#41;
              at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke&#40;RunAsSecurityInterceptor.java&#58;90&#41;
              at org.jboss.ejb.plugins.LogInterceptor.invoke&#40;LogInterceptor.java&#58;191&#41;
              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke&#40;ProxyFactoryFinderInterceptor.java&#58;122&#41;
              at org.jboss.ejb.MessageDrivenContainer.internalInvoke&#40;MessageDrivenContainer.java&#58;372&#41;
              at org.jboss.ejb.Container.invoke&#40;Container.java&#58;723&#41;
              at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke&#40;JMSContainerInvoker.java&#58;914&#41;
              at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage&#40;JMSContainerInvoker.java&#58;1208&#41;
              at org.jboss.jms.asf.StdServerSession.onMessage&#40;StdServerSession.java&#58;276&#41;
              at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage&#40;SpyMessageConsumer.java&#58;871&#41;
              at org.jboss.mq.SpyMessageConsumer.addMessage&#40;SpyMessageConsumer.java&#58;159&#41;
              at org.jboss.mq.SpySession.run&#40;SpySession.java&#58;347&#41;
              at org.jboss.jms.asf.StdServerSession.run0&#40;StdServerSession.java&#58;200&#41;
              at org.jboss.jms.asf.StdServerSession.run&#40;StdServerSession.java&#58;180&#41;
              at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run&#40;PooledExecutor.java&#58;748&#41;

      Comment


      • #4
        I'm not a regular JBoss user, but I would try to specify the JNDI name as "UserTransaction". You could add a property to your transaction manager definition:
        Code:
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
          <property>
            <value name="userTransactionName">UserTransaction</value>
          </property>
        </bean>

        Comment


        • #5
          Yes I did that... and it works...

          mmm - what appservers are the examples being run on ??

          :?

          Seems funny....

          Thanks !!

          Comment

          Working...
          X