• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am befuffled by this behaviour!

 
saran sadaiyappan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am experiencing a problem when sending a message through POJO class.I ll explain the problem as follows:
I am creating a normal message sending code and then sending it to a local queue to which an MDB is listening(the queue is created in a local server)...now its working fine.But when I send the message to a Foreign JMS server(local JNDI name of the foreign JMS server) where the queue has a local and remote JNDI name...the error is like
"java.net.ConnectException: t3://localhost:7001: Destination unreachable".

Now I tried by creating a war file and deployed the same and I posted the message to the local JNDI name of the queue in the foreign JMS server...and it s sending messages correctly..

So my question is how the one for POJO failed and the same worked for a web application?Is it something related to the server container??
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saran,


So my question is how the one for POJO failed and the same worked for a web application?Is it something related to the server container??

This kind of errors might happen when the environment for local (remote) clients is not properly set. Good examples are the java.naming.provider.url and the java.naming.factory.initial environment variables. The server always initializes these properties when starts up, while local clients need to set them explicitly when initializing the naming context. Hence the next code:

Works very well within a jsp or servlet deployed to the app server (the ejb container and the web server are collocated), but will fail with a remote client. The problem could be easily solved:

If these two properties are not set at all you�ll get a very specific messages that clearly indicates this fact. In your case I believe that the POJO reads the properties from the local server, but tries to access a remote location. A code similar to the one above might solve your problem.
If this doesn�t work, you should probably post the client code as well.
Regards.
 
saran sadaiyappan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your clarification friend.But will the server initialise the naming rovider url to the localhost or the remote machine?The Foreign JMS server will do with the provider URL the remote machine and the local server with that of the local one....Am i right?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right.
 
Kunaal A Trehan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saran

Basically when u try to send the message from the .war file.
Initial Context and other stuff is taken care as ure working
in the same env.
However when u re using remote client u need to specific where exactly it
shd do the look up.

Moreover when u re sending message to the Foriegn JMS Server.
Basically u re sending message to a local queue
which internally is mapped to remote machine.
This facility is provided in Weblogic.

I think it clarifies u how exactly look up and other thing happens

Kunal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic