Monday, August 20, 2007

Tomcat and Symbolic Links

I didn't expect Tomcat would really care about symbolic links. Say you put together a web application in a directory and want to use a web.xml you have elsewhere. Instead of copying web.xml to the WEB-INF directory, you create a symbolic link.

You would expect this work out of the box, wouldn't you? Well, no. For security reasons Tomcat won't follow your symbolic links, unless you specify on the Context of your web application allowLinking="true", as in:

<context path="/my-app" docBase="/Users/avernet/my-app"
allowLinking="true"/>