Web Services clients cache DNS addresses which may result in a java.net.ConnectionException or java.IO.Exception.
 Technote (troubleshooting)
 
Problem(Abstract)
When using a DNS load balancer or IP failover, the web service clients cache DNS addresses. (I would copy the paragraph "The customer may see a wide variety of exceptions..." here. Also are there WSWS messages that may be observed?) (Another question, is this only applicable to Windows®? Your list of OS's only lists Windows.)
 
Cause
The caching of DNS addresses actually happens at the JVM level. By default, DNS addresses are cached forever in the JVM.

Consider the following scenario. A Web service client is programmed to send traffic to http://www.myhost.com. The DNS entry www.myhost.com maps to two IP addresses: 192.168.1.1 and 192.168.1.2. Here is what happens when the Web service client invokes the service:

  1. Web service client does a DNS lookup on "www.myhost.com."
  2. DNS server returns "192.168.1.1" for "www.myhost.com."
  3. The JVM caches this. The JVM has a cache that associates "www.myhost.com" with "192.168.1.1."
  4. For every invocation onwards, the Web service client will not lookup "www.myhost.com" from the DNS server. It will always assume that it is "192.168.1.1."

The customer can see a wide variety of exceptions related to this. Some examples are:
  • java.net.ConnectException: A remote host refused an attempted connect operation
  • java.io.IOException: Connection reset by peer
 
Resolving the problem
You can set a parameter to give a refresh rate for this cache:

sun.net.inetaddr.ttl=time_in_seconds

After the specified number of seconds has passed, the cache is refreshed and picks up any changes made to the DNS, so an application can go to the correct IP.

Add this parameter as a command line property by preceding it with a "-D" on the Application Server running the application in question.

For WebSphere® Application Server V5.0, V5.1 and V6.0 releases:
Application Servers > Server name > Process Definition > Java™ Virtual Machine > Generic JVM Arguments

Refer to the Sun documentation regarding these properties under the Related information section for additional information.

 
Related information
Java Networking Properties
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Web Services (for example: SOAP or UDDI or WSGW or WSIF)
Operating system(s): Windows
Software version: 6.1
Software edition:
Reference #: 1220381
IBM Group: Software Group
Modified date: Jan 31, 2007