Sunday, December 20, 2009

Deploying Grails application on Tomcat6 on Ubuntu

Hi,

I've just had a few moments of struggle deploying my Grails application onto Tomcat installed via apt-get in Ubuntu. Thanks to the Ubuntu forum it didn't morph into a war :)

After apt-get install tomcat6 and putting my application into the webapps folder I've restarted Tomcat using the usual script but could not access my application at all. The log said something like this:

SEVERE: Exception sending context destroyed event to listener instance of class org.codehaus.groovy.grails.web.util.Log4jConfigListener
java.security.AccessControlException: access denied (java.util.PropertyPermission grails.env read)

After a few minutes of search I found the answer. By default Tomcat on Debian and Ubuntu uses a security manager that prevents application to access environment variables. Why this is the case I don't know but it is. And it is easy to turn it off. Just edit the file /etc/default/tomcat6 and change the line that reads

#TOMCAT6_SECURITY=yes

into

TOMCAT6_SECURITY=no

and live is good again.

Hope this helps!

1 comment:

Unknown said...

Helped me out, thanks!