Announcement Announcement Module
No announcement yet.
How to implement WebSphereUowTransactionManager Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement WebSphereUowTransactionManager


    Please find the details below.

    I am getting an exception while using WebSphereUowTransactionManager. Here is the exception details:

    Cannot resolve reference to bean 'txManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'txManager_UOW' defined in class path resource [/spring.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org/springframework/transaction/jta/WebSphereUowTransactionManager.initUserTransaction AndTransactionManager()V

    I ran my applcation in the debug mode and found that control is reaching till the call to initUserTransactionAndTransactionManager() in org.springframework.transaction.jta.WebSphereUowTr ansactionManager but then instead of going into this method it throws above exception. The initUserTransactionAndTransactionManager() is the protected method in the superclass (org.springframework.transaction.jta.JtaTransactio nManager) of WebSphereUowTransactionManager.

    Other Details: Versions
    I am using Spring-Framework-2.5.2 and RSA (with WAS version6.1.0.9).

    Here is the relevant snippet from the the spring configuration file
    <bean id="txManager_UOW" class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />
    <alias name="txManager_UOW" alias="txManager" />
    <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
          <property name="transactionManager" ref="txManager" />
          <property name="transactionAttributes">
                    <prop key="insert*">PROPAGATION_REQUIRED,-DomainDataDAOException
                   <prop key="update*">PROPAGATION_REQUIRED,-DomainDataDAOException
    	  <prop key="retrieve*">PROPAGATION_REQUIRED, readOnly, -DomainDataDAOException
    <bean id="transactionTestDAO" parent="baseTransactionProxy">
    	<property name="target" ref="transactionTestDAOImpl" />
    <bean id="transactionTestDAOImpl" class="com.nm.ltc.domain.transaction.test.TransactionTestDAOImpl">
                <property name="sqlMapClient">
                            <ref bean="sqlMapClient" />
    Any help on this would be much appreciated.

    Last edited by Ritwick; Jun 3rd, 2008, 06:38 PM.

  • #2
    I expect that you are mixing spring versions. Make sure you only have one spring.jar or the correct spring-[module].jar in your classpath.


    • #3
      Thanks Marten. It was the same issue infact.

      Actually this transaction manager works fine for a single datasource, but fails in case we have multiple datasources. I am using two sybase datasources installed on two different boxes. Here is the description of the problem:

      The initiated transaction keeps hold of the first connection and substitutes it for every connection requested thereafter. Obviously the first connection will not work with any datasource but the one it is connected to. Thinking from transaction’s perspective it should have a reference to the first connection to rollback in case the query for second datasource fails. So the clever transaction is playing safe from its point of view. And thus I am not able to connect to the second datasource.

      Both of the databse get updated if I don't use the transaction manager.
      There should be some way to enable the request for the new connection instead of picking it up from the transactions cache reference.

      Here is code that i am using to fire the queries from sql maps (I am using iBATIS with Spring).

      private Object doInsert(String theSQL, TestData testData, String dataSource) throws DomainDataDAOException {
                   Connection conn = null;
      	SqlMapSession session = null;
      	try {
      		// dataSource will have different values for different datasources. Refer to handbook for more details.
      		conn = getSqlMapClientTemplate().getSqlMapClient().getDataSource().getConnection();
      		session = getSqlMapClientTemplate().getSqlMapClient().openSession(conn);
      		return ((Object) session.insert(theSQL, testData));
      	} catch (SQLException exSQLException) {
      	             throw new DomainDataDAOException("SQLException has occured while fetching the data.", exSQLException);
      		} catch (SqlMapException exSqlMapException) {
      			throw new DomainDataDAOException(	"There seems to be a type mismatch for the columns in sqlmap"+ 
                                             "and the model for the table.", exSqlMapException);
      		} catch (Exception ex) {
      			throw new DomainDataDAOException("Exception occured while fetching the data.", ex);
      		} finally {
      			if (session != null)
      			try {
      				if (conn != null)
      			} catch (SQLException exSQLException) {
      				throw new DomainDataDAOException(
      						"SQLException has occured while closing the database connection.",
      Could you please suggest the solution for this.

      Last edited by Ritwick; Jun 4th, 2008, 06:41 PM.


      • #4
        1) Don't do resource management yourself. You use the template then also use its methods.
        2) Use XA capable datasource
        3) Use JNDI registered datasource not a local (spring configured datasource)


        • #5
          There seems to be some DTM related issue with the server. We are working on that.
          Thanks for your help on this Marten.