0 Replies Latest reply on Mar 9, 2013 3:17 PM by pascal salg

    Working with multiple CDI Portable Extensions inside a WAR

    pascal salg Newbie



      I've observed some strange behaviour when working with a modular JSF Application (consisting of a WAR with JARs inside of it). Some of the JARs provide CDI Portable Extensions as part of the application architecture.


      All extensions have the same name and the same package. Besides Extension, they implement a second interface each registering a List of Objects inside a central class. Basically all the extensions do the exact same thing.


      But as long as the extensions have the same fully-qualified name only the extension in the alphabetically first project gets loaded as many times as there are cdi extensions in the war.


      For example with the following setup only the ExtensionImpl from adm.jar gets loaded BUT it gets loaded three times (so again for tag.jar and usr.jar instead of the Extensions from these projects being loaded..)


      project [web.war] -> com.acme.Registry

      - project [adm.jar] -> com.acme.ExtensionImpl

      - project [tag.jar] -> com.acme.ExtensionImpl

      - project [usr.jar] -> com.acme.ExtensionImpl


      The following setup resolves this issue:


      project [web.war] -> com.acme.Registry

      - project [adm.jar] -> com.acme.adm.ExtensionImpl

      - project [tag.jar] -> com.acme.tag.ExtensionImpl

      - project [usr.jar] -> com.acme.usr.ExtensionImpl


      Is there possibly some classloading issue in CDI with portable Extensions?


      I am using JBoss 7.1.1 final.


      Greetz from Germany