java and local dns cache

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-03-31
I have an application that tests connectivity to web and oracle servers. Recently I replaced all of the IP addresses that I'd hardcoded in my java app with DNS names that I keep in a local host file. For testing purposes, I have two hosts files, one with valid IP addresses and one with names that resolve to IP addresses that aren't reachable from my network. HOWEVER, when the application has been running using the "good" hosts file, it continues to run fine once I copy in the "bad" hosts file, even when I run "ipconfig /flushdns" after loading the "bad" hosts file.

Does java use a separate internal dns cache? Any ideas?

Question by:SteveJ
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 7990326
can you post source code?

Accepted Solution

Friedfly earned 800 total points
ID: 8351669
Yes, it does.

For an example, see http://developer.java.sun.com/developer/bugParade/bugs/4256129.html

You can run with the command line parameter -Dsun.net.inetaddr.ttl=0 to cause the cache to immediately expire and not be used.

Expert Comment

ID: 9059225
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Expert Comment

ID: 9333219
I'm not particularly concerned about points, but I *did* provide an accurate and correct answer, and it seems to me that it would be best to leave it here for other people to see if they have the same problem.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question