I am having trouble setting up a MDP in Spring 3.0.4 in WebSphere 7.0 using the WebSphereUowTransactionManager
.
If I don't use WebSphereUowTransactionManager
, it works just fine. Without it, I won't have any XA-action on errors, so I think I really need that.
Here is what happens on the server:
[9/22/10 16:26:35:093 CDT] 00000070 SystemOut O 16:26:35.093 [WorkManager.DefaultWorkManager : 4] DEBUG o.s.t.j.WebSphereUowTransactionManager - Creating new transaction with name [jmsContainer]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
[9/22/10 16:26:36:140 CDT] 00000070 SystemOut O 16:26:36.140 [WorkManager.DefaultWorkManager : 4] DEBUG o.s.j.l.DefaultMessageListenerContainer - Initiating transaction rollback on listener exception
java.lang.NullPointerException: null
at org.springframework.jms.listener.AbstractMessageListenerContainer.commitIfNecessary(AbstractMessageListenerContainer.java:571) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:354) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056) [org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:952) [org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.scheduling.commonj.DelegatingWork.run(DelegatingWork.java:61) [org.springframework.context.support-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1150) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:199) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:188) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550) [com.ibm.ws.runtime.jar:na]
[9/22/10 16:26:36:140 CDT] 00000070 SystemOut O 16:26:36.140 [WorkManager.DefaultWorkManager : 4] DEBUG o.s.t.j.WebSphereUowTransactionManager - Initiating transaction rollback
[9/22/10 16:26:41:140 CDT] 00000070 SystemOut O 16:26:41.140 [WorkManager.DefaultWorkManager : 4] WARN o.s.j.l.DefaultMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'queue://testQ?busName=WorkManagementBus' - trying to recover. Cause: null
java.lang.NullPointerException: null
at org.springframework.jms.listener.AbstractMessageListenerContainer.commitIfNecessary(AbstractMessageListenerContainer.java:571) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:354) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:952) ~[org.springframework.jms-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.scheduling.commonj.DelegatingWork.run(DelegatingWork.java:61) [org.springframework.context.support-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1150) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:199) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:188) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550) [com.ibm.ws.runtime.jar:na]
[9/22/10 16:26:41:140 CDT] 00000070 SystemOut O 16:26:41.140 [WorkManager.DefaultWorkManager : 4] INFO o.s.j.l.DefaultMessageListenerContainer - Successfully refreshed JMS Connection
Here is my applicationContext.xml
file:
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />
<bean id="myTaskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
<property name="workManagerName" value="wm/default" />
</bean>
<jee:jndi-lookup id="queue" jndi-name="jms/queue" resource-ref="true" proxy-interface="javax.jms.Queue"></jee:jndi-lookup>
<jee:jndi-lookup id="connectionFactory" jndi-name="jms/ConnectionFactory" resource-ref="true"></jee:jndi-lookup>
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"></property>
<property name="destination" ref="queue"></property>
<property name="messageListener" ref="testMessageListener"></property>
<property name="taskExecutor" ref="myTaskExecutor"></property>
<property name="transactionManager" ref="transactionManager"></property>
</bean>
<bean id="testMessageListener" class="navy.jmsey.TestMessageListener" />
I can't figure out why this isn't working. I think I'm doing everything I'm supposed to. I followed the directions in http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html.
Anyone seen this or see what I'm doing wrong?
Thanks.
Update: I've tried doing a EJB3 Message-driven Bean and that works as expected, on exception it gets redelivered up to 5 times. The problem with that, is the semantics for dependency injection and transaction containment just got more complicated. I'm pretty sure this isn't how I want to go.
Update: I asked WebSphere support, but they turned me away. As expected.