JBoss overlay does not support JSP recompilation

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

  • We've configured an overlay in our application's WEB-INF/jboss-web.xml. JSPs in this overlay directory is never recompiled as expected per our web subsystem's jsp configuration settings (development and modification-test-interval).

Resolution

  • Overlays do not support JSP recompilation by design currently.
  • An alternative method of serving JSPs outside of your application is to use a symlink as described in the following article. This symlink served content does support JSP recompilation.

Root Cause

  • Overlays are designed to serve as external content libraries; their lookups are expensive so overlay content is cached permanently and never reloaded. Thus, overlays do not support JSP recompilation as the updated JSP is never loaded. You can see here the permanent caching for Overlay content in the ProxyDirContext source:

      // Set timestamp
      if (currentContext == dirContext) {
          entry.timestamp = System.currentTimeMillis() + cacheTTL;
      } else {
          // Overlay cache never expire
          entry.timestamp = Long.MAX_VALUE;
      }
    
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.