0

I have deployed an activemq queue(QueueA) on JBoss EAP 7.1 server running on my local machine. I have a Spring-Boot app which is also running on the same machine and having a listener for this queue which implements "MessageListener". I have used the following dependencies in my Spring-Boot app :

1. <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
</dependency>

2.
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
</dependency>

3.
<dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-broker</artifactId>
</dependency>

I have created connection factory the following way : 
ActiveMQConnectionFactory connectionFactory =
                new ActiveMQConnectionFactory();

        connectionFactory.setBrokerURL(tcp://localhost:8080);
        connectionFactory.setUserName("Username");
        connectionFactory.setPassword("Password");

Now when I start my Spring-Boot app it gives me the following error initially :
ERROR : Not Connected: [ClusterNode]

and following error repetitively until I stop the app:

ERROR : DefaultMessageListenerContainer: Error : Could not refresh JMS Connection for destination 'QueueA'.Cause: Cannot send, channel has already failed: tcp://127.0.0.1:8080


Can anyone please help in this regard ? or Point me to some documentation which would be helpful
Spartan
  • 45
  • 1
  • 7
  • Is there a stack-trace involved? If so, please include that in your question. If not, please elaborate a bit more about what the application is doing in general and specifically what the application is doing when the error occurs. – Justin Bertram Mar 28 '18 at 01:51

1 Answers1

0

I believe the problem here is that JBoss EAP 7 embeds the ActiveMQ Artemis broker, but your dependency is for libraries meant to work with ActiveMQ 5.x (i.e. a different broker). Check out the pom.xml from the "Helloworld JMS" quick-start for EAP 7.1.

To be clear, ActiveMQ Artemis does support 5.x clients, but I believe that functionality is disabled by default in EAP.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Thanks for pointing me to that github resource. But the resource didn't help me. I still have the same problem – Spartan Mar 30 '18 at 17:54
  • Are you still using the `org.apache.activemq:activemq-broker` dependency? – Justin Bertram Mar 30 '18 at 17:59
  • I'm using this one : com.redhat.jboss jboss-client 7.1.1 – Spartan Mar 30 '18 at 19:31
  • Where did you get `com.redhat.jboss:jboss-client`? The pom.xml in the quickstart I linked is using `org.jboss.eap:wildfly-jms-client-bom`. In any event, if you are't using the `org.apache.activemq:activemq-broker` dependency anymore then the code you pasted using the ActiveMQ 5.x connection factory implementation should no longer compile (as expected). Is that the problem you're hitting now? If not, what problem are you hitting? – Justin Bertram Mar 30 '18 at 20:31
  • I'm not using any of the spring active mq dependencies. One of my friends suggested to exclude some artifacts from spring that might conflict with the JBoss dependencies and use the JBoss dependency mentioned in the previous comment. I have created the connection factory with same properties in the article you pointed before using the "DefaultMessageListenerContainer". Now I get the following error : Could not refresh JMS Connection for destination 'QueueA'. Cause: AMQ119031: Unable to validate user – Spartan Apr 02 '18 at 21:33
  • And I have excluded all the embedded containers provided by spring and Creating TomcatEmbeddedServletContainerFactory in the Configuration class – Spartan Apr 02 '18 at 21:35
  • So you've adjusted your dependencies and moved past the original `Cannot send...` error, and now you're hitting a different issue marked by `AMQ119031: Unable to validate user`. Is that correct? I assume you also changed your client code so you're no longer using the ActiveMQConnectionFactory from ActiveMQ 5.x. Is that also correct? Based on the `Unable to validate user` I would conclude that you aren't passing the proper security credentials when you're creating your connection. It's probably worth updating your original question or creating a new one since so much has changed at this point. – Justin Bertram Apr 03 '18 at 02:41
  • Thank You Justin. I'm using the correct credentials. I will post the new issue in a new post – Spartan Apr 03 '18 at 17:49