Skip to content

Possible workaround for deploying multiple Vaadin 8.x WARs in a single EAR on Wildfly #282

@peholmst

Description

@peholmst

An issue that has poped up now and then is that it is not possible to deploy multiple Vaadin 8 WARs (including CDI) inside a single EAR. I have investigated this using Wildfly 16 and I think I may have found a workaround.

The problem seems to be that some of the @CDIUI beans end up with a scope annotation that has been loaded by the wrong class loader. This in turn seems to be caused by the fact that Weld caches the scope classes that it has retrieved from the stereotype annotations. Since @CDIUI contains the @UIScope annotation, it will be cached once and then reused everywhere - including in UIs that come from a different WAR (and thus from a different class loader).

The workaround seems to be to simply add the @UIScope annotation directly to the UI classes (next to the @CDIUI annotation). By doing this, Weld follows a different path to look up the scope and seems to find the right scope from the right class loader.

There may be more issues than this one hiding below the surface but here is at least a start if you need to deploy multiple WARs inside a single EAR.

This at least seems to solve the problem described in #97 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionv8Issues or PRs for Vaadin 8 version of the add-on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions