Unable to connect create netty connection (HornetQ 2.3.1 Final + JBoss EAP 6.1)
vahid001 Nov 8, 2013 2:11 PMHello all,
I have been struggling with this issue for days and have read various posts and documentation regarding Netty and HornetQ to have this resolved, so this is kind of a last resort (hoping someone can help get this clarified).
Please see below for the key information segments in bold
When connecting remotely to a JMS queue, I keep getting the following error on the client side:
Nov 8, 2013 7:46:44 PM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.7.GA-redhat-1
Nov 8, 2013 7:46:44 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA-redhat-1
Nov 8, 2013 7:46:44 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.16.GA-redhat-1
Nov 8, 2013 7:46:58 PM org.hornetq.core.remoting.impl.netty.NettyConnector createConnection
ERROR: HQ214016: Failed to create netty connection
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
at java.net.Socket.connect(Socket.java:527)
at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:105)
at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:65)
at org.jboss.netty.channel.Channels.connect(Channels.java:634)
at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:207)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182)
at org.hornetq.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:628)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1223)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1069)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:246)
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:828)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:583)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:107)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:102)
at com.helios.model.TestJMS.main(TestJMS.java:130)
Nov 8, 2013 7:46:58 PM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver handleEnd
ERROR: Channel end notification received, closing channel Channel ID bf946580 (outbound) of Remoting connection 372c9557 to /remoteipHere:4447
Exception in thread "main" javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:587)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:107)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:102)
at com.helios.model.TestJMS.main(TestJMS.java:130)
Caused by: HornetQException[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:852)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:583)
... 3 more
Hereby the output on JBoss server side:
[org.jboss.as.naming] (Remoting "hosted-by" task-4) JBAS011806: Channel end notification received, closing channel Channel ID 3f946580 (inbound) of Remoting connection 1555511f to null
I have a standalone.xml configured with the following information (these are the relevant snippets):
<subsystem xmlns="urn:jboss:domain:messaging:1.3">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<security-enabled>false</security-enabled>
<journal-type>NIO</journal-type>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging">
</netty-connector>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging">
</netty-acceptor>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
......
......
<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="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
<client-failure-check-period>60000</client-failure-check-period>
<connection-ttl>150000</connection-ttl>
<call-timeout>30000</call-timeout>
<consumer-window-size>1048576</consumer-window-size>
</connection-factory>
<jms-destinations>
<jms-queue name="testersQueue">
<entry name="queue/Testers"/>
<entry name="java:jboss/exported/jms/queue/Testers"/>
</jms-queue>
</jms-destinations>
.......
.......
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="any">
<any-address/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-native" interface="any" port="${jboss.management.native.port:9999}"/>
<socket-binding name="management-http" interface="any" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="any" port="${jboss.management.https.port:9443}"/>
<socket-binding name="ajp" port="8009"/>
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="messaging" interface="any" port="5445"/>
<socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/>
<socket-binding name="messaging-throughput" port="5455"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
</server>
When starting JBoss the following message is shown:
HQ221020: Started Netty Acceptor version 3.6.2.Final-redhat-1-c0d783c 0.0.0.0:5455 for CORE protocol
HQ221020: Started Netty Acceptor version 3.6.2.Final-redhat-1-c0d783c 0.0.0.0:5445 for CORE protocol
HQ121005: Invalid "host" value "0.0.0.0" detected for "netty" connector. Switching to "hosted-by.webxtra.net". If this new address is incorrect please manually configure the connector to use the proper one.
Also tried adding the "param host and port" as stated in the example below for both connector and acceptor, but still no luck:
<connectors>
<connector name="netty">
<param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
<param key="ssl-enabled" value="true"/>
</connector>
</connectors>
Some relevant client code is show below:
Context initialContext = null;
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote://remoteIPHere:4447");
properties.put(Context.SECURITY_AUTHENTICATION, "simple");
properties.put(Context.SECURITY_PRINCIPAL, "heritrix");
properties.put(Context.SECURITY_CREDENTIALS, "heritrix#001");
connectionFactory = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory");
Queue queue = (Queue) context.lookup("jms/queue/Tester");
I really do hope that someone is able to help figure this out as I have been struggling with this issue now for days.
Your help is much appreciated.
In case of any more clarification or code/configuration snippets, please let me know. Thanks in advance.