Hi Lin,

   our current 'Overlay feature" implementation is quite limited to be honest.
It is not possible to introduce new files inside jar inside war that is in ear.
The only exception is if war is exploded inside ear.
   Further more it is not possible to overlay static content inside wars
(although Wildfly documentation for overlays feature promises that).
The reason is every war is exploded to temporary location during
the deploy process and


obtains physical location of that exploded archive and passes it to
FileResourceManager / PathResourceManager in its constructor.

This at first sight innocent hack bypasses all VFS modifications.
So although you would mount war static files properly via overlays,
those overlays will be completely ignored.
The only exception are deployment descriptors,
which are processed during the deployment phase.

Note: Don't get confused with overlays in ServletResourceManager.
Those are Undertow specific and have nothing to do with WildfFly deployment overlays.

   In order to fix your concrete problem (i.e. adding new file inside
jar in war in ear) I'd guess fixing just DeploymentOverlay processors will be insufficient.
With high probability you'll need to revisit also WarDeploymentStructureProcessor.

   Good news is 'Wildfly Deployment Overlays' should work without any limitations in
upcomming Wildfly 11. There's a PR eliminating Wildfly dependency on JBoss VFS:


The PR incorporates 'Deployment Overlay' complete rewrite with no limitations
current implementation has.

On 12/23/2015 05:17 PM, Lin Gao wrote:

    I am working on https://issues.jboss.org/browse/WFCORE-761 for a while, and I am stuck in the case of overlaying files in jar of war of ear.

    I want to know that do we support overlay for files in jar of war of ear? like: xx.ear/yy.war/zz.jar/META-INF/config.properties

    DeploymentOverlayDeploymentUnitProcessor.java[1] and DeferredDeploymentOverlayDeploymentUnitProcessor.java[2] are classes to handle the deployment overlay, but in this case, the jar of war of ear does not get mounted yet, which leads to DeferredDeploymentOverlayDeploymentUnitProcessor.handleEntryWithFileParent() method is called, which just prints the error message.

   The way to fix it maybe mount the jar(VFS.mountZip) beforehand, but it is specific to the case of ear/war/jar, and these 2 classes are more generic(they are in wildfly-core, no ee nor undertow extension), so where this can be fixed?

[1] https://github.com/wildfly/wildfly-core/blob/master/server/src/main/java/org/jboss/as/server/deployment/DeploymentOverlayDeploymentUnitProcessor.java
[2] https://github.com/wildfly/wildfly-core/blob/master/server/src/main/java/org/jboss/as/server/deployment/DeferredDeploymentOverlayDeploymentUnitProcessor.java

Best Regards
Lin Gao
JBoss Software Engineer

wildfly-dev mailing list

Richard Opalka
Principal Software Engineer
JBoss by Red Hat
Mobile: +420 731 186 942