• Article for your preferred language does not exist. Below is international version of the article.

Article ID: 919, created on Oct 6, 2008, last review on May 2, 2014


Such problem usually occurs if an application tries to access some resources but it has no rights to access them due to Tomcat security settings which can be managed through $CATALINA_HOME/catalina.policy. The errors can be realated to MySQL dstsbsde connection or some file accessing. Let see typical permission errors.

1. An application cannot connect to MySQL database. The error received: "Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)"

To allow
DOMAIN.TLD/APPLICATION/ WebApp TCP/IP connections add the section into catalina.policy:
grant codeBase "file:/var/cache/tomcat4/work/PSA/DOMAIN.TLD/APPLICATION/-" {
permission java.net.SocketPermission "IP_ADDRESS", "resolve, connect";

Restart Tomcat service after catalina.policy modification.

See for more information: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/security-manager-howto.html

Note: for Debian the lines must be added into /etc/tomcat4/policy.d/04webapps.policy.
Note: Tomcat 5 has similar settings, see http://tomcat.apache.org/tomcat-5.0-doc/security-manager-howto.html

Email subscription for changes to this article
Save as PDF