Tomcat caches old dns entry of Single Sign On system‏

有些话、适合烂在心里 提交于 2019-12-11 21:05:48

问题


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:


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



来源:https://stackoverflow.com/questions/25090259/tomcat-caches-old-dns-entry-of-single-sign-on-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!