0 Replies Latest reply on Aug 9, 2019 2:27 PM by Himanshu Sharma

    Connect to an Active MQ artemis queue deployed in Wildfly11 from a Spring Boot app

    Himanshu Sharma Newbie

      HI,

       

      I am trying to connect to an Active MQ artemis queue deployed in Wildfly11 from a Spring Boot based microservice. I am using the below artemis dependency in Spring boot app:

      compile group: 'org.springframework.boot', name: 'spring-boot-starter-artemis', version: '2.1.6.RELEASE'

       

      I have set below in my application.properties :

      spring.artemis.mode=native

      spring.artemis.host=tcp://myhost

      spring.artemis.port=8080

      spring.artemis.user=username

      spring.artemis.password=password

       

      But I get the below exception:

       

      2019-08-09 12:11:15,497 28665 [DefaultMessageListenerContainer-1] ERROR o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination '/jms/topic/mytpoic' - retrying using FixedBackOff{interval=5000, currentAttempts=2, maxAttempts=unlimited}. Cause: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]

      javax.jms.JMSException: Failed to create session factory

      at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:757)

      at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:265)

      at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:260)

      at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)

      at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:413)

      at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:398)

      at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:925)

      at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:899)

      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1077)

      at java.lang.Thread.run(Unknown Source)

      Caused by: org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException: AMQ119007: Cannot connect to server(s). Tried with all available servers.

      at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:787)

      at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:755)

      ... 9 common frames omitted

      2019-08-09 12:11:20,500 33668 [DefaultMessageListenerContainer-1] ERROR o.a.activemq.artemis.core.client - AMQ214016: Failed to create netty connection

      java.net.UnknownHostException: tcp://myhost

      at java.net.InetAddress.getAllByName0(Unknown Source)

      at java.net.InetAddress.getAllByName(Unknown Source)

      at java.net.InetAddress.getAllByName(Unknown Source)

      at java.net.InetAddress.getByName(Unknown Source)

      at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:40)

      at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:62)

      at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:53)

      at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:55)

      at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:31)

      at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:106)

      at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:208)

      at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:49)

      at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:188)

      at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:174)

      at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)

      at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)

      at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427)

      at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:111)

      at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:82)

      at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:897)

      at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:508)

      at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:419)

      at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:478)

      at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)

      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)

      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)

      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)

      at java.lang.Thread.run(Unknown Source)

       

      Please help.

       

      Thanks & Regards

      Himanshu