July 25, 2008

HOW TO : Configure JBoss to follow symbolic links

Jboss, in addition to being an application server also serves static content. We recently ran into an issue where some static content was not displayed when users hit the link. The JBoss server kept spewing 404 errors, stating that the content was not found. On some hair pulling research, we figured out that JBoss, like Apache, does not follow/allow content mapped to a symbolic link.

So for example in your web app, you added a sym link to another directory, where most of your content is stored, Jboss would not show the content, when you go to the link.

Here’s a quick guide to fix this.

  1. Go to the deploy folder of the context you want to configure. For example, if you used the default context, you go to $JBOSS_HOME/server/default/deploy/jboss-web.deployer
  2. Edit the context.xml file and add allowLinking=”true” in the Context (NOTE : This allows Jboss to publish symbolic links on all apps in your application server, if you want to restrict it to just one particular app, you have to edit the context.xml in your specific application folder). Upon adding the option, our context.xml file looked as such



   

   
   org.jboss.web.tomcat.security.RunAsListener

More information on options for the context.xml can be found here

http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2.1.0/config/context.html

For the record, Jboss configuration and accompanying documentation is what I call black magic :).. Too many options, too many ways to do the same thing.