How do I use a fully qualified host name for the "java.naming.provider.url" property in the "env" parameter passed into (J2EE) InitialContext class. Whether I pass in an IP address, or a fully qualified (host.domain...) host name, the lookup( name) call will fail, saying it cannot find the hostname, where the hostname is just the "basename" of the host without its domain. E.g. - say that mypc.somedomain.net is 1.2.3.4, putting in either "1.2.3.4" or "mypc.somedomain.net" will fail with something like:
javax.naming.CommunicationException java.rmi.UnknownHostException: mypc
Do I need to pass a DNS server into InitialContext? What isn't it smart enough to just let the underlying OS do the job? (as in "ping mypc.somedomain.net", which just works)
The client and the server are neither on the same machine, nor the same subnet, so I have to use a fully qualified hostname. To refine this a bit for "Robin", we normally run a client process in a separate JVM which typically hits a server on localhost, or sometimes on another host on the same subnet / domain (e.g. - "testbox") which does not require a fully qualified name.
Also, I tried adding the "jns://" prefix and ":1099" suffix (e.g. - "jns://mypc.somedomain.net:1099"), not that these were required to make "testbox" work, and got the same exception.
I have googled around and found several instances of this error (InitialContext / JBoss -> UnknownHostException) or similar question, but no answers. Ouch.