I have tomcat 6.0.14 (installed in Red hat linux 5.5 and with java 6 update 13) integrated with a Single sign on system.
When SSO (Single Sign On) 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 tomcat every time SSO system fail overs to different data center.
Is there a way to configure tomcat to refresh DNS with out restarting when SSO fail overs.
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:
Edit the
java.security
file found in$JRE_HOME/lib/security
and change thenetworkaddress.cache.ttl
to something sensible instead of -1 (the default more or less).Modify the command that launches Tomcat to change the setting, i.e. at the parameter
-Dsun.net.inetaddr.ttl=xxx
wherexxx
is some sensible value.Change it within your app by running:
java.security.Security.setProperty("networkaddress.cache.ttl" , "xxx");