You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeffery Welden <jw...@rim.com> on 2005/01/22 00:45:02 UTC

DNS TTL Security Properties Not Working Inside a Servlet in Tomcat 4

In a stand-alone java 1.4.2 program,

java.security.Security.setProperty("networkaddress.cache.ttl", "0");
for (int i=0; i<20; i++)
    System.out.println( java.net.InetAddress.getByName( "earthlink.net" ) );

will round robin through the several IP addresses bound to "earthlink.net" hostname
because it's not getting cached inside InetAddress.java due to the above security property.


However, from within a servlet (in Tomcat 4), the same code behaves differently:

    InetAddress.getByName() will always return the first IP address returned from InetAddress.getAllByName(), that is, as though the security property was never set.  Thus, InetAddress continues to cache the IP.

In the servlet,
    Security.getProperty( "networkaddress.cache.ttl" )  returned "0", so it was indeed set.
    It seems like tomcat is providing its own implementation of InetAddress.java??

I didn't find anything in the Tomcat 4 source that suggested it replaces the Sun-provided DNS provider or InetAddress.java somehow.  I'm at a loss.  :-/

Any help explaining this and/or how to work around this would be awesome!

Thanks,

Jeff





---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org