Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

java and local dns cache

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?

  • 2
1 Solution
can you post source code?
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.
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.
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now