Announcement Announcement Module
Collapse
No announcement yet.
NullPointerException on Transaction Startup at DefaultMessageListenerContainer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

    Code:
    java.lang.NullPointerException
        at com.ibm.ejs.container.EJSContainer.processTxContex tChange(EJSContainer.java:2434)
        at com.ibm.ejs.container.UserTransactionWrapper.begin (UserTransactionWrapper.java:207)
        at org.springframework.transaction.jta.JtaTransaction Manager.doJtaBegin(JtaTransactionManager.java:863)
        at org.springframework.transaction.jta.JtaTransaction Manager.doBegin(JtaTransactionManager.java:820)
        at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:371)
        at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.receiveAndExecute(AbstractP ollingMessageListenerContainer.java:240)
        at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(DefaultMessageListenerContainer.java:1058)
        at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:952)
        at org.springframework.scheduling.commonj.DelegatingW ork.run(DelegatingWork.java:61)
        at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext .java:1150)
        at com.ibm.ws.asynchbeans.WorkWithExecutionContextImp l.go(WorkWithExecutionContextImpl.java:199)
        at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkIt emImpl.java:188)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j 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.

    Code:
    <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" />
    </bean>
    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.

    Code:
    <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" />
    </bean>
    I've also tried using a JtaTransactionManager, as below, instead of the WebSphere-specific one, but again, it didn't work.

    Code:
    <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: http://forum.spring.io/forum/spring-...nager-on-split. 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

    Cheers.
    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!

    Comment

    Working...
    X