Tomcat caches old dns entry of Single Sign On syst

2019-09-06 20:16发布

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.

1条回答
地球回转人心会变
2楼-- · 2019-09-06 20:56

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");

查看更多
登录 后发表回答