*
The moose likes JBoss/WildFly and the fly likes not able to connect to JBOSS message queue frome remote machine. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "not able to connect to JBOSS message queue frome remote machine." Watch "not able to connect to JBOSS message queue frome remote machine." New topic
Author

not able to connect to JBOSS message queue frome remote machine.

kunal green
Greenhorn

Joined: Dec 31, 2009
Posts: 26

Hi ,

I am new to JBOSS.

I am trying to connect to MessageQueue.From a different machine.



i have written a sample code as :

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

env.put(Context.URL_PKG_PREFIXES, "org.jboss.namingrg.jnp.interfaces");

// Create the initial context

Context ctx = new InitialContext(env);

// Lookup the JMS connection factory from the JBoss 5.1 object store

ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");

Queue queue = (javax.jms.Queue)ctx.lookup("/queue/DLQ");

Connection connection = connectionFactory.createConnection();

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer messageProducer = session.createProducer(queue);

TextMessage textMessage = session.createTextMessage();

textMessage.setText("Hello World");

System.out.println("Sending Message: " + textMessage.getText());

messageProducer.send(textMessage);





This code is working fine when i run it from the same machine on which jboss is running.





As per my understanding JBOSS doesnot listens from other machines by default.so i restarted it with run.bat -b 0.0.0.0

and then i try to connect it from a different machine with same code snippet.

but i am getting below exception:

Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0

javax.jms.JMSException: Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0

at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:375)

at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)

at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)

at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)

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

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

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

at com.ericsson.mediation.jms.JMSClient.connect(JMSClient.java:75)

at com.ericsson.mediation.jms.JMSConnectionController.initPrimary(JMSConnectionController.java:226)

at com.ericsson.mediation.jms.JMSConnectionController.initConfig(JMSConnectionController.java:111)

at com.ericsson.mediation.jms.JMSJavaActivityValueRouter.<init>(JMSJavaActivityValueRouter.java:64)

Caused by: HornetQException[errorCode=2 message=Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0]

... 11 more



Seems my machine running the client knows about the jboss and its somehow looking something on port 5445 and host 0-0-0-0.



Please help.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9961
    
163

I guess you changed your client code too, after you started the server with the -b option. What does the client code look like now, especially the JNDI URL?

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not able to connect to JBOSS message queue frome remote machine.
 
Similar Threads
JMS
JBoss deployment error in windows
connectionfactory not bound exception
JBoss JMS Remote Queue
Configure/Access remote Message Queue (Sun's Open MQ) on Nework