Tuesday, January 18, 2011

Ubuntu Server and Tomcat 6 WebApp SecurityUtil Exception

I am running clean install of Ubuntu Server 9.10 with Tomcat 6 installed from the Ubuntu installation. When I upload a WebApp through the Tomcat Manager and it starts automatically on boot with /etc/init.d/tomcat6 start my Lib Jars in my Web Apps WebContent/WEB-INF/lib throw an exception.

I am using Project ROME for my RSS Feed which works fine on my local tomcat server I test on through Eclipse. However, when I run it on the Ubuntu Tomcat I get a ServletException:

javax.servlet.ServletException: Could not initialize class com.sun.syndication.feed.synd.SyndFeedImpl
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:294)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)

I am guessing I need to change one of the files in /etc/tomcat6/policy.d/ which generates the /var/cache/tomcat6/catalina.policy file. But I don't know what to change. Help please!

  • Okay, I got something that works.

    I edited the /etc/tomcat6/policy.d/01system.policy and added at the bottom:

    // Grant WebApps All Permission
    grant codeBase "file:/var/lib/tomcat6/webapps/-" {
        permission java.security.AllPermission;
    };
    

    This works now, but not sure if its the right thing to do.

  • You could disable the security manager for Tomcat as whole.

    Edit /etc/default/tomcat6 and set TOMCAT6_SECURITY to no.

    TOMCAT6_SECURITY=no
    

    (Make sure the line is uncommented)

    Be sure you understand the implications of doing this though.

0 comments:

Post a Comment