Announcement Announcement Module
Collapse
No announcement yet.
Spring Transaction Management for Websphere Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Transaction Management for Websphere

    Hey guys!! Happy New Year!

    I am facing a strange behavior with spring tx management, maybe any of you has faced the same problem.

    Here's the scenario:

    I have 4 boxes with a Websphere 5.1 Instance hosting some web applications, and I am using Spring to manage the transactions the following way:

    Code:
    <bean id="webSphereJtaTm" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean"/>
    <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    		<property name="transactionManager" ref="webSphereJtaTm"/>
    </bean>
    
    <bean id="OrderDAO" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    	<property name="target">
    		<ref local="orderProcessor" />
    	</property>
    	<property name="transactionManager" ref="jtaTransactionManager"/>
    	<property name="transactionAttributes">
    		<props>
    			<prop key="saveOrder">
    				PROPAGATION_REQUIRED,timeout_60,-java.lang.Exception
    			</prop>
    			<prop key="deleteOrder">
    				PROPAGATION_REQUIRES_NEW,timeout_60,-java.lang.Exception
    			</prop>
    			<prop key="loadOrder">
    				PROPAGATION_REQUIRES_NEW,timeout_60,-java.lang.Exception
    			</prop>
    			<prop key="getPersistence">
    				PROPAGATION_SUPPORTS,timeout_60
    			</prop>
    			<prop key="setPersistence">
    				PROPAGATION_SUPPORTS,timeout_60
    			</prop>
    		</props>
    	</property>
    </bean>
    The problem is that sometimes it seems that for one of my servers the transaction manager for UserTransaction is not created properly since I am getting a NullPointerException:

    [1/5/09 17:13:39:223 EST] 72f2ba5 BaseAction E com.gap.gid.ecom.action.BaseAction TRAS0014I: The following exception was logged java.lang.NullPointerExce
    ption
    at com.ibm.ejs.container.EJSContainer.processTxContex tChange(EJSContainer.java:1814)
    at com.ibm.ejs.container.UserTransactionWrapper.begin (UserTransactionWrapper.java:175)
    at org.springframework.transaction.jta.JtaTransaction Manager.doJtaBegin(JtaTransactionManager.java:886)
    at org.springframework.transaction.jta.JtaTransaction Manager.doBegin(JtaTransactionManager.java:843)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:374)
    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:263)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:101)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java (Compiled Code))
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy15.loadOrder(Unknown Source)


    The thing I've seen is that for the other 3 servers I am using JTA UserTransaction: com.ibm.ws.Transaction.JTA.UserTransactionImpl and for the one that is getting the exception I am getting JTA UserTransaction: com.ibm.ejs.container.UserTransactionWrapper.

    Another thing, I've also found a quick workaround, if I reload the application context the beans start working fine.

    Has anyone faced the same problem?

    Is there any way to tell spring to use the com.ibm.ws.Transaction.JTA.UserTransactionImpl class instead of the ejs one?

    Or does anyone know why am I facing like an initialization problem, I think this might be a websphere configuration thing but I am not quite sure.

    Any help is really appreciated!!

    Thank you!!

    - Vic
Working...
X