wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes JMS Client Communication behind NAT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Client Communication behind NAT" Watch "JMS Client Communication behind NAT" New topic

JMS Client Communication behind NAT

Maruthi Chokkanathan

Joined: Dec 06, 2005
Posts: 10
Hi All,
I have a problem in JMS Client lookup. Our present network configuration is
Client <-->NAT<-->NAT<--->Server.
When I try to lookup the Server from my Client I am getting an error like connection refused.
But I can able to connect through browser(i.e. http).

In the jndi lookup I specified the NAT address. The code can able to communicate the NAT address and able to identify the corresponding local Computer IP Address also.But I am getting connection refused exception.
What could be the problem?

My JNDI Lookup Code is
java.util.Properties properties = new java.util.Properties();


properties.put(Context.URL_PKG_PREFIXES,"org.jboss.naming rg.jnp.interfaces");


InitialContext iniCtx = new InitialContext(properties);
Object tmp = iniCtx.lookup("ConnectionFactory");
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;

I am getting the following error if try to run my client

Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: (Internal IP Address)

Do I need to specify anything else?


Maruthi Chokkanathan

Joined: Dec 06, 2005
Posts: 10
Hi All,
Finally I got the answer by referring the wiki page in JBOSS web site.
When I try a JNDI lookup, JBOSS returns the internal IP address i.e. jboss binds the system ip address instead of the NAT address. So I set a system property by specifying the rmi address of server to the corresponding NAT address in the server side. Now it works.

I agree. Here's the link: http://aspose.com/file-tools
subject: JMS Client Communication behind NAT
Similar Threads
JDBC lookup failure through java:comp....
JMS and client application
Failed to initialize the ORB using websphere.
Run stand alone JMS client ...