Cannot connect to HornetQ via Remote call when wildfly 8.1.0 install is behind a NAT
juice0123 Jul 30, 2014 2:03 PMCannot connect to jms via Remote call when wildfly 8.1.0 installs are on a different subnet. I currently have this working on the same subnet. I can connect when on the same subnet, but when on a different subnet, it fails to create the connection. The following is the method i use that works on the same subnet and breaks on a different subnet.
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://" + ip + ":" + port));
env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", User));
env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", Password));
initialContext = new InitialContext(env);
//The next two lines work
ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory");
Destination destination = (Destination) initialContext.lookup("java:/jms/queue/" + queueName);
//fails here, cannot create the connection
Connection connection = cf.createConnection(User, Password);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(destination);
connection.start();
I had this working on jboss 5.1.0 sending to remote queue messages to the queue on a jboss7.1.2 install, but only with the host file on the client machine changed to reflect the host name of the machine to its ip. I have ported both servers the wildfly 8.1.0 and I can't get it working across different subnets. I keep getting the following error
javax.jms.JMSException: Failed to create session factory
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) [jboss-client-8.1.jar:8.1.0.Final]
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:669) [jboss-client-8.1.jar:8.1.0.Final]
Any Ideas?