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: access denied ( 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 "IP_ADDRESS", "resolve, connect";

Restart Tomcat service after catalina.policy modification.

See for more information:

Note: for Debian the lines must be added into /etc/tomcat4/policy.d/04webapps.policy.
Note: Tomcat 5 has similar settings, see

Email subscription for changes to this article
Save as PDF