XsltException caused by JRebel

Notice: This post is more than a year old. It may be outdated.

I stumbled upon a problem where a Java web application complained about an XsltException which was caused by a missing stylesheet. Although the stylesheet existed, it was not found for some reason.

After configuring log4j to see, where the app was looking for the stylesheet, I realised that it was being looked for from the wrong location. The cause of the problem was Maven and JRebel. The following is a snippet from the pom.xml file.

<webResources>
  <resource>
    <directory>${basedir}/resources/${conf.name}</directory>
  </resource>
  <resource>
    <directory>${basedir}/../build/ear/web</directory>
  </resource>
</webResources>

The issue was that these resource tags were in reverse order in rebel.xml and that caused the application to look for stylesheets from the wrong location. As a side note, this issue was seen only on Windows environments, Linux and OSX were fine. To fix it, I changed the order in my pom.xml file.

comments powered by Disqus