Announcement Announcement Module
No announcement yet.
NullPointerException on Transaction Startup at DefaultMessageListenerContainer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • NullPointerException on Transaction Startup at DefaultMessageListenerContainer

    I have a Spring batch job, configured using Spring integration/JMS for distributed processing in a master and slave architecture. I have listener container beans configured for the master and the slaves on the XML of the job. The listener container for the slaves are started up when the system is initialized - our spring context is initialized at that stage. So when the system is up, we (should) always have a configured number of listener containers representing the slaves, listening on the JMS queue where step execution requests will be coming from.

    The problem is that, when those listener containers - which are polling ones - attempt to read from the JMS queue, they try to start a transaction but fail to do so. This behaviour is only on WebSphere though, and it's failing inside WebSphere code, thus making very hard to pinpoint what exactly is wrong here. In any case, the stack trace is:

        at tChange(
        at (
        at org.springframework.transaction.jta.JtaTransaction Manager.doJtaBegin(
        at org.springframework.transaction.jta.JtaTransaction Manager.doBegin(
        at atformTransactionManager.getTransaction(AbstractPl
        at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.receiveAndExecute(AbstractP
        at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(
        at org.springframework.jms.listener.DefaultMessageLis tenerContainer$
        at org.springframework.scheduling.commonj.DelegatingW
        at .java:1150)
        at l.go(
        at$ ava:1604)
    And here's part of my job XML configuration. This is how I had originally setup - which works fine for WebLogic and JBoss (4), by using WebLogicJtaTransactionManager and JtaTransactionManager respectively instead of WebSphereUowTransactionManager.

    <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphe reUowTransactionManager" />
    <bean id="requestListener" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
        <property name="taskExecutor" ref="workManagerTaskExecutor" />
        <property name="concurrentConsumers" value="4" />
        <property name="destinationName" value="queue/PartitioningRequestQueue" />
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="sessionTransacted" value="false" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="receiveTimeout" value="3600" />
        <property name="destinationResolver" ref="jndiDestinationResolver" />
    I've tried setting the user transaction and uow manager names explicitly on the WebSphere transaction manager, as below, and also switching the "sessionTransacted" property to "true". None of that worked though.

    <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphe reUowTransactionManager">
        <property name="userTransactionName" value="java:comp/UserTransaction" />
        <property name="uowManagerName" value="java:comp/websphere/UOWManager" />
    I've also tried using a JtaTransactionManager, as below, instead of the WebSphere-specific one, but again, it didn't work.

    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager" />
    After some googling and forum searching, the closest I've found to the problem I'm facing was this thread: The solution posted in there, however, won't serve me, because my listener containers are initialized upfront and not only with the step.

    I'm completely lost here honestly. It could well be something very silly that I've missed, so if anyone has any hints that could help I'd appreciate.

    The versions for some of the Spring jars I'm using are:
    Spring Transaction: 3.0.5.RELEASE
    Spring JMS: 3.0.5.RELEASE
    Spring Beans: 3.0.5.RELEASE
    Spring Batch: 2.1.7.RELEASE
    Spring Batch Integration: 1.2.0.RELEASE
    Spring Integration Core: 2.0.0.RELEASE

    Last edited by emerson.loureiro; Dec 18th, 2013, 02:19 PM. Reason: Adjusting formatting

  • #2
    Sorry for not getting to this sooner. We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-batch tag. If you do post it there, please reply here with the link. Thanks!