• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI bug? - Specifying host IP in in InitialContext ignored

 
Lloyd Shove
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As JNDI provides no automatic failover mechanism when creating a connection I was about to try and implement one myself. However I have found that when specifying an IP address instead of a server name when creating an initial context JNDI doesn't necessarily use the IP address specified. It seems to do a reverse-dns lookup in the background and use whatever IP is listed first in the Naming tables for that hostname. why oh why does it do that!!

I NEED to specify what IP address it tries to form the connection over. does anyone know a way I can do this or a way of making JNDI retry on the alternate IP address for a hostname?


Thanks

Background - I need a remote connection to a JNDI registry and the server in question has two nics and IPs. if one IP is inaccessible due to that LAN being dead I need access via the other IP but I don't know how to manage that.



 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What application server are you running on? Some (like WebSphere) do provide automatic failover without your having to do a thing...

Kyle
 
Lloyd Shove
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I probably didn't explain the situation perfectly.

The client is running as a standalone app that is trying to obtain a reference to an object bound to the JNDI registry within JRun.

I was unsure whether the actual lookup not using the IP I specify (but instead using the first IP specified for that host in the DNS tables) was a JNDI problem/feature I can workaround or whether it was due to the App server driver I'm using.

Also I'm running on win 2k.

thanks again
 
Frederico Melo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lloyd,

the JNDI API is mostly implemented by the provider (in this case, JRun). The specification doesn't mention anything about fail-over and stuff, so the way lookup is done is left to the class specified in InitialContext properties' ContextFactory (java.naming.factory.initial). So, if it's not working as expected you should check JRun's implementation.
In last case, just try to analise the source code for the InitialContextFactory JRun's implementation to see what's done. JAD can do miracles..



regards,

Fred
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!