Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect to Tibco JMS server

Tags:

java

jms

tibco

I have a java application which does some JMS send&receive work. But I found an interesting problem. For example, I set the following for java.naming.provider.url.

tcp://hostnameA.foo.bar:7222

But I got the error as below. Only hostname in it, not the full qualified domain name.

javax.jms.JMSException: Failed to connect to the server at tcp://hostnameA:7222

Unless I add hostnameA in my hosts file manually, it won't connect to Tibco server.

How can I fix it?

Thanks in advance.

like image 695
Smartmarkey Avatar asked Sep 13 '11 08:09

Smartmarkey


People also ask

How do I connect to a JMS server?

You can connect to any JMS server by using the Java Naming and Directory Interface (JNDI) to locate an existing JMS connection factory. Depending on where the connection factory is bound, the connection URL can begin with the string lookup or the string jndi.

What is JMS In Tibco?

Java Message Service (JMS) is a specification about sending and receiving messages between two or more applications in a Java environment. The JMS palette is used to send and receive JMS messages in a process. The models supported are: Point-to-Point (queues): Message delivered to one recipient.


1 Answers

The EMS Server has its own built-in JNDI server. What you're actually doing when you connect is 1) querying the EMS:s JNDI server for a connection factory definition and then 2) creating a connection based on the returned factory. This is implied by the fact that you're using java.naming.provider.url.

Change the connection factory definition (factories.conf) on the EMS server for the connection factory you're using. The default definition for the default factories (e.g. QueueConnectionFactory) on a fresh install is "tcp://7222" which will be replaced by "tcp://hostname:7222" by the server when retrieved. You can change this definition to e.g. "tcp://hostname.myfqdn.com:7222" and things should work.

You could also bypass the JNDI server completely by creating a connection directly, but I wouldn't recommend this since the connection factory definition returned by the server may contain information about load balanced and fault tolerant pairs, SSL settings, or point to a completely different server pair etc. It also allows the EMS administrators to change the definition of connection factories without the clients having to change their code or even their configuration.

like image 138
stoft Avatar answered Oct 05 '22 11:10

stoft