Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-157

NullPointerException on second message delivery (using spring and jca connector)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4, 2.0
    • 2.0
    • None
    • None
    • spring 1.1.3, activemq 1.4 / 2.0

    Description

      I am running an external active mq broker (default config on tcp://localhost:61616) and use the following spring config shown below.
      Now i am sending messages to myTopic via

      JmsTemplate jt = new JmsTemplate(connectionFactory);
      jt.setPubSubDomain(true);
      jt.convertAndSend("myTopic", text);

      The first message is properly processed but any further messages result in the following NullPointerException:

      java.lang.NullPointerException
      at
      org.codehaus.activemq.jca.LocalTransactionEndpoint.beforeDelivery(LocalTransactionEndpoint.java:48)
      at
      org.codehaus.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.beforeDelivery(MessageEndpointProxy.java:124)
      at
      org.codehaus.activemq.ra.MessageEndpointProxy.beforeDelivery(MessageEndpointProxy.java:70)
      at
      org.codehaus.activemq.ra.ActiveMQRASession.preDeliveryHook(ActiveMQRASession.java:174)
      at
      org.codehaus.activemq.ActiveMQSession.run(ActiveMQSession.java:553)
      at
      org.codehaus.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:137)

      A sample project is available for download at
      http://null.reucon.net/~srt/activemq-npe.zip

      spring config:

      <bean id="jmsFactory" class="org.codehaus.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL">
      <value>tcp://localhost:61616</value>
      </property>
      </bean>

      <!-- JCA container for ActiveMQ -->
      <bean id="activeMQContainer" class="org.codehaus.activemq.jca.JCAContainer" depends-on="jmsFactory">
      <!-- the work manager (thread pool) for this container -->
      <property name="workManager">
      <bean id="workManager" class="org.codehaus.activemq.work.SpringWorkManager"/>
      </property>
      <!-- the JCA Resource Adapter -->
      <property name="resourceAdapter">
      <bean id="activeMQResourceAdapter" class="org.codehaus.activemq.ra.ActiveMQResourceAdapter">
      <property name="serverUrl"><value>tcp://localhost:61616</value></property>
      </bean>
      </property>
      </bean>

      <!-- inbound message connector -->
      <bean id="messageConnector" factory-method="addConnector" factory-bean="activeMQContainer">
      <!-- subscription details -->
      <property name="activationSpec">
      <bean class="org.codehaus.activemq.ra.ActiveMQActivationSpec">
      <property name="destination"><value>myTopic</value></property>
      <property name="destinationType"><value>javax.jms.Topic</value></property>
      </bean>
      </property>
      <!-- the bean used to process the message -->
      <property name="messageListener">
      <ref bean="targetBean"/>
      </property>
      </bean>

      <bean id="targetBean" class="TargetBean"/>

      Attachments

        Activity

          People

            jstrachan James Strachan
            srt Stefan Reuter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: