FAQ: Unable to create a connection to: [[ServerEntry, hostname="xxxxx", port="yyyy"]]

View: New views
3 Messages — Rating Filter:   Alert me  

FAQ: Unable to create a connection to: [[ServerEntry, hostname="xxxxx", port="yyyy"]]

by IIT Software () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Answer:
 
It seems that the host "xxxxx" isn't reachable from your client. The router stores the hostname of the router within the connection factory. The client uses it to create a connection then. If the hostname isn't resolvable by DNS, you can't connect.

You can resolve it by 2 ways:

1) Add the router's host "xxxxx" to your DNS or /etc/hosts at your client.
2) Add connectaddress=<ip> to the JMS listener element "plainsocket" in the routerconfig.xml. "ip" is the IP address of the router's host (xxxxx). Subsequent connects will use the IP instead of the hostname

Re: FAQ: Unable to create a connection to: [[ServerEntry, hostname="xxxxx", port="yyyy"]]

by paksiw :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

IIT Software wrote:
Answer:
 
It seems that the host "xxxxx" isn't reachable from your client. The router stores the hostname of the router within the connection factory. The client uses it to create a connection then. If the hostname isn't resolvable by DNS, you can't connect.

You can resolve it by 2 ways:

1) Add the router's host "xxxxx" to your DNS or /etc/hosts at your client.
2) Add connectaddress=<ip> to the JMS listener element "plainsocket" in the routerconfig.xml. "ip" is the IP address of the router's host (xxxxx). Subsequent connects will use the IP instead of the hostname

Hi,

Both solutions require the user to explicitly set either the hostname in etc/hosts or the ipaddress in the plainsocket in routerconfig.xml.

Is there a way to avoid setting the ipaddress/ hostname explicitly to be able to connect to the remote router? Is there a way to connect to remote router with just it's ipaddress at hand?

I have made a simple application that connects to a remote router. User enters the ipaddress at runtime. So this means, I will have to set all possible ipaddress and hostnames in the etc/hosts that the user might enter. Please help. Thank you.

Re: FAQ: Unable to create a connection to: [[ServerEntry, hostname="xxxxx", port="yyyy"]]

by IIT Software :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As the FAQ entry states:

1) The router determines its own host name and stores it in the connection factory.
2) The connection factory is transfered to the JMS client on a JNDI lookup.
3) The client uses the connection factory to create the actual JMS connection. It uses the host name / IP address stored in the connection factory.

You have to differentiate 2 kinds of connections:

1) The JNDI connection
2) The JMS connection

Concerning 1) you use a JNDI provider URL to connect to SwiftMQ's JNDI. This URL is called the SMQP-URL and looks like this:

   smqp://<ip/host>:<port>/<properties>

For example:

   smqp://192.168.0.47:4001/timeout=10000

Because SwiftMQ's JNDI works over JMS internally, the SMQP-URL just points to a router's JMS listener. You have to use the router's IP address.

Concernig 2) your client uses the JMS connection factory to create a connection. If you want that your JMS client should use the IP address of the router, simply specify it as "connectaddress" attribute and you are done.

So this means, I will have to set all possible ipaddress and hostnames in the etc/hosts that the user might enter.
The user can only enter a limited number of IP addresses - those on which the router is reachable. You can also bind a JMS listener to a particular network card by using the "bindaddress" attribute. That way you don't need to set the "connectaddress" attribute. If you use the "bindaddress" and specify the IP here, the JMS listener is only reachable on this interface and that's it.

Another point is a firewall. If you have your router running inside the firewall using a private class C network, e.g. 192.168.0.0, and you have clients outside the firewall, you need the "connectaddress" set to the public IP of the firewall. The firewall needs to be NAT configured to translate between the public IP/port and the internal IP/port of the router's host.

So actually that's all you have to respect. You neither need to specify many IP addresses nor do you need to set up a proper DNS.