Posts RSS Comments RSS 46 Posts and 34 Comments till now

Tomcat security issue with jdbc connections

This is a reminder for me, for Tomcat setting about security violation.

In a simple servlet, if you have some issue with db connection, with this output:

    java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)

have a look at Tomcat security policy.

To correct this problem, you have to edit /etc/tomcat5/policy.d/

We want to give all contexts not configured by their own grant entry some default permissions in addition to what Tomcat assigns by default:

    grant {
        permission java.net.SocketPermission "localhost:3306","listen,connect,resolve";
        permission java.util.PropertyPermission "*","read";
    };

You may have to replace localhost:3306 with your db host and port.

Trackback this post | Feed on Comments to this post

Leave a Reply