0

I have Tomcat 6.0.14 (installed in RedHat Linux 5.5 and with Java 6 update 13) integrated with a SSO (Single Sign On) system.

When SSO fail overs to a different data center (and SSO's IP address changes) the Tomcat continues to stick to the old DNS entry of the SSO system.

I then have to restart the Tomcat container so that it picks the new DNS of the SSO system. I have to restart the Tomcat every time SSO system fails over to different data center.

Is there a way to configure Tomcat to refresh DNS with out restarting when SSO fails over?

Yuri
  • 4,254
  • 1
  • 29
  • 46

1 Answers1

2

The problem here isn't Tomcat specific, but rather specific to the virtual machine. In particular, see the documentation for InetAddress. This answer provides the solution, but I'll give some options for completeness:

There seem to be three options:

  1. Edit the java.security file found in $JRE_HOME/lib/security and change the networkaddress.cache.ttl to something sensible instead of -1 (the default more or less).

  2. Modify the command that launches Tomcat to change the setting, i.e. at the parameter -Dsun.net.inetaddr.ttl=xxx where xxx is some sensible value.

  3. Change it within your app by running: java.security.Security.setProperty("networkaddress.cache.ttl" , "xxx");

Community
  • 1
  • 1
ig0774
  • 39,669
  • 3
  • 55
  • 57
  • That sounds right to me, and here is a SO post about Java DNS caching and how to set TTL: http://stackoverflow.com/questions/1256556/any-way-to-make-java-honor-the-dns-caching-timeout-ttl – Jon Onstott Jan 21 '16 at 20:22