0

i want to use the Spring JMSListener infrastructure. So i set up an ActiveMQ instance and tried to do a simple test. Here is my spring config:

   <!-- ActiveMQ Configuration -->
    <jms:annotation-driven/>

    <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
    <bean id="jmsConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://xxxx.xxxx.net:8161" />
    </bean>


    <bean id="jmsListenerContainerFactory"
          class="org.springframework.jms.config.DefaultJmsListenerContainerFactory">
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
        <property name="concurrency" value="3-10"/>
    </bean>

Of course i have a simple class like this:

@Component
public class MessageListenerExample {

    @JmsListener(destination = "TestQueue")
    public void doSomething(String message) {
        System.out.println("OnMessage Received  :" + message);

    }
}

Now when i startup the spring based application. i see in the debugger that my listener methods gets registered but somehow Spring doesnt connect to the ActiveMQ queue, which i can see easily by looking in the activeMQ web console. Furthermore i dont see any logging output from spring what the JMS stuff does.

Do i miss something? Whats the best way to go from here? Of course i also tested to send a message from within the web console of ActiveMQ but w/o a client connection, there is no hope of delivery. Thanks for any input.


Update: i found a stacktrace...

[WARN 14:02:58] DefaultMessageListenerContainer.handleListenerSetupFailure(860) | Setup of JMS message listener invoker failed for destination 'TestQueue' - trying to recover. Cause: The JMS connection has failed: Unknown data type: 47
org.apache.activemq.ConnectionFailedException: The JMS connection has failed: Unknown data type: 47
    at org.apache.activemq.ActiveMQConnection.checkClosedOrFailed(ActiveMQConnection.java:1480)
    at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:324)
    at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:192)
    at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1400(DefaultMessageListenerContainer.java:122)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1162)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1141)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1134)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1031)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Unknown data type: 47
    at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:365)
    at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:285)
    at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
    ... 1 more
Xstian
  • 8,184
  • 10
  • 42
  • 72
Logemann
  • 2,767
  • 33
  • 53

1 Answers1

2

Because I looked in the wrong log, I have not seen the obvious. I am posting this because this is something many could stumble over.

I defined the wrong port in the spring config. I mistakenly used the web console port but I wanted of course the TCP transport being used which lives on port 61616.

This was mentioned by Bruce Snider somewhere in the web as a reply the same problem.

Asanke
  • 551
  • 1
  • 11
  • 32
Logemann
  • 2,767
  • 33
  • 53
  • Can you check this? http://stackoverflow.com/questions/39177437/how-connect-to-wildfly-10-1-0-final-activemq-artemis-using-jndi-and-spring How implemented your connectionFactory?? Are you using ActiveMQ Artemis ? – Sergio Aug 29 '16 at 22:03