Session replication is not enabled as expected even if <distributable/> is specified in web.xml of web application on JBoss EAP 6.x/7.x

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x

Issue

  • We've deployed a war with the <distributable/> flag set in its web.xml, but session replication is still not being enabled
  • A deployed war file with <distributable/> in its web.xml will not start the cluster, from the logfile it seems like the application is not clustered

Resolution

  • There should be no library included that uses a web-fragment.xml without the <distributable/> tag. Ensure EVERY web-fragment.xml includes the <distributable/> tag.

  • Otherwise, set metadata-complete="true" in your WEB-INF/web.xml web-app element to disable annotation and web-fragment scanning of included jars

  • The request to get a notification that the distributable flag is disabled is This content is not included.BZ 1337858. So, the WARN log message like The deployment example.war will not be distributable because this feature is disabled in web-fragment.xml of the module web-fragment-example.jar. will be output when your web-fragment.xml does not have <distributable/> in EAP 6.4.11 or later.

Root Cause

If the BYTEMAN script is used it may have output like this:

INFO  [stdout] (MSC service thread 1-3) BYTEMAN: WebCommonMetaData.setDistributable: org.jboss.metadata.web.spec.Web30MetaData@299c024b org.jboss.metadata.javaee.spec.EmptyMetaData@1f
INFO  [stdout] (MSC service thread 1-3) BYTEMAN: WebCommonMetaData.setDistributable: org.jboss.metadata.web.spec.Web30MetaData@299c024b null

This looks like distributable was picked up and applied for the web.xml but reset later when processing a web-fragment.

Diagnostic Steps

  • Use the attached byteman rules for further information on the handling of the web.xml
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.