Note that there are some explanatory texts on larger screens.

plurals
  1. POHornetQ JMSException: Failed to create session factory
    primarykey
    data
    text
    <p>I'm trying to Directly instantiating JMS Resources without using JNDI to a REMOTE HORNETQ.</p> <p>I am running my test code in Eclipse IDE. Setup my classpath to use the HornetQ 2.2.5 libraries.</p> <p>The target HornetQ is version 2.1.2.Final, I figured they should be backwards compatible, maybe im wrong?</p> <p>Okay, so I have read the online documentation and followed the examples on connecting to a remote JMS server without using JNDI. I keep on getting the following exception. Im not sure what Im missing but I believe I have everything setup correctly. Could someone please point out what Im missing here? Thanks in advance.</p> <p><strong>JMSException: Failed to create session factory</strong></p> <p>The connector on hornetq-configuration.xml is:</p> <pre><code> &lt;connector name="netty"&gt; &lt;factory-class&gt;org.hornetq.core.remoting.impl.netty.NettyConnectorFactory&lt;/factory-class&gt; &lt;param key="host" value="${10.100.111.222}"/&gt; &lt;param key="port" value="${hornetq.remoting.netty.port:5445}"/&gt; &lt;/connector&gt; </code></pre> <p>The acceptor is:</p> <pre><code> &lt;acceptor name="netty"&gt; &lt;factory-class&gt;org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory&lt;/factory-class&gt; &lt;param key="host" value="${10.100.111.222}"/&gt; &lt;param key="port" value="${hornetq.remoting.netty.port:5445}"/&gt; &lt;/acceptor&gt; </code></pre> <p>My Test code is: Connection connection = null;</p> <pre><code> try { Queue queue = HornetQJMSClient.createQueue("TESTQ"); Map&lt;String, Object&gt; connectionParams = new HashMap&lt;String, Object&gt;(); connectionParams.put(TransportConstants.PORT_PROP_NAME, 5445); connectionParams.put(TransportConstants.HOST_PROP_NAME, "10.100.111.222"); TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams); ConnectionFactory factory = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration); System.out.println("debug: " + factory.getClass()); connection = factory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(queue); TextMessage message = session.createTextMessage("This is a test message"); System.out.println("Sent message: " + message.getText()); producer.send(message); } finally { if (connection != null) { try { connection.close(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } </code></pre> <p>I get the following Exception</p> <pre><code>SEVERE: Failed to create netty connection java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:114) at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:74) at org.jboss.netty.channel.Channels.connect(Channels.java:541) at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:218) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188) at org.hornetq.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:450) at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1016) at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:897) at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:212) at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:602) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:611) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:121) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116) at com.ws.proto.ManualJMS.main(ManualJMS.java:39) Oct 19, 2011 1:18:50 PM org.hornetq.core.logging.impl.JULLogDelegate warn WARNING: Tried 1 times to connect. Now giving up on reconnecting it. Exception in thread "main" javax.jms.JMSException: Failed to create session factory at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:615) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:121) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116) at com.ws.proto.ManualJMS.main(ManualJMS.java:39) Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.] at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:619) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:611) ... 3 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload