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
In my code I use :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)
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>${datasource.name}</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>


Reply With Quote