6 Replies Latest reply on Jan 14, 2016 6:13 AM by Arkady Zelekman

    Wildfly 8: java.nio.channels.UnresolvedAddressException during creating JMS connection from remote client

    Arkady Zelekman Newbie

      Hello, team

       

      I am trying to create JMS connection from remote client machine to Wildfly 8 server:

       

      ConnectionFactory cf = initialContext.lookup("jms/ConnectionFactory");

      cf.createConnection();

       

      The result is :

       

      java.nio.channels.UnresolvedAddressException

        at sun.nio.ch.Net.checkAddress(Net.java:121)

        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:617)

        at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:176)

        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:169)

        at io.netty.channel.DefaultChannelPipeline$HeadHandler.connect(DefaultChannelPipeline.java:1008)

        at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:495)

        at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:480)

        at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)

        at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannelDuplexHandler.java:168)

        at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:495)

        at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:480)

        at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:50)

        at io.netty.channel.DefaultChannelHandlerContext.invokeConnect(DefaultChannelHandlerContext.java:495)

        at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:480)

        at io.netty.channel.DefaultChannelHandlerContext.connect(DefaultChannelHandlerContext.java:465)

        at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:847)

        at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:199)

        at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:165)

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

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

        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)

        at java.lang.Thread.run(Thread.java:745)

      2016-01-12 11:16:24 [Thread-7] ERROR messaging.client.MessagingManager  - ERROR: Exception was thrown in setMessageListener

      javax.jms.JMSException: Failed to create session factory

        at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:673)

        at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:112)

        at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:107)

        at com.allot.nms.common.messaging.client.MessagingManager.setupSub(MessagingManager.java:73)

        at com.allot.nms.common.messaging.client.MessagingManager.setMessageListener(MessagingManager.java:92)

        at com.allot.nms.common.messaging.client.MessagingHelper.setMessageListener(MessagingHelper.java:105)

        at com.allot.nms.client.model.alarms.AlarmsModelController.reload(AlarmsModelController.java:134)

        at com.allot.nms.client.ui.frm.Controller.reloadAllDataFromServer(Controller.java:539)

        at com.allot.nms.client.ui.frm.Controller.access$1(Controller.java:444)

        at com.allot.nms.client.ui.frm.Controller$DataLoader.run(Controller.java:1389)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: HornetQNotConnectedException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]

        at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:905)

        at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:669)

       

      The problem is solved when I adding an entry to "hosts" file of the client machine, but this solution is not acceptable to our customers.

       

      I didn't to any changes for connectors/acceptors in standalone.xml:

       

              <subsystem xmlns="urn:jboss:domain:messaging:2.0">

                  <hornetq-server>

                      <security-enabled>false</security-enabled>

                      <journal-file-size>102400</journal-file-size>

       

       

                      <connectors>

                          <http-connector name="http-connector" socket-binding="http">

                              <param key="http-upgrade-endpoint" value="http-acceptor"/>

                          </http-connector>

                          <http-connector name="http-connector-throughput" socket-binding="http">

                              <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>

                              <param key="batch-delay" value="50"/>

                          </http-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

       

       

                      <acceptors>

                          <http-acceptor http-listener="default" name="http-acceptor"/>

                          <http-acceptor http-listener="default" name="http-acceptor-throughput">

                              <param key="batch-delay" value="50"/>

                              <param key="direct-deliver" value="false"/>

                          </http-acceptor>

                          <in-vm-acceptor name="in-vm" server-id="0"/>

                      </acceptors>

       

       

                      <security-settings>

                          <security-setting match="#">

                              <permission type="send" roles="guest"/>

                              <permission type="consume" roles="guest"/>

                              <permission type="createNonDurableQueue" roles="guest"/>

                              <permission type="deleteNonDurableQueue" roles="guest"/>

                          </security-setting>

                      </security-settings>

       

       

                      <address-settings>

                          <address-setting match="#">

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                              <max-size-bytes>10485760</max-size-bytes>

                              <page-size-bytes>2097152</page-size-bytes>

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

                          </address-setting>

                      </address-settings>

       

       

                      <jms-connection-factories>

                          <connection-factory name="InVmConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <connection-factory name="RemoteConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="http-connector"/>

                              </connectors>

                              <entries>

                                  <entry name="jms/ConnectionFactory"/>

                                  <entry name="java:jboss/exported/jms/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <pooled-connection-factory name="hornetq-ra">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/JmsXA"/>

                                  <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

       

       

                      <jms-destinations>

                          <jms-queue name="ExpiryQueue">

                              <entry name="java:/jms/queue/ExpiryQueue"/>

                          </jms-queue>

                          <jms-queue name="DLQ">

                              <entry name="java:/jms/queue/DLQ"/>

                          </jms-queue>

                          <jms-topic name="NMSTopic">

                              <entry name="topic/NMSTopic"/>

                              <entry name="java:jboss/exported/topic/NMSTopic"/>

                          </jms-topic>

                      </jms-destinations>

                  </hornetq-server>

              </subsystem>

       

      Can anybody help ?

       

      Thank you in advance.