2 Replies Latest reply on Jan 8, 2014 2:18 PM by pugals

    CDI fails in multiple war inside ear in AS 6.1 - depends on war name

    pugals

      There is a issue with simple CDI injection when the ear contains more than one war file.

      Here is the simple scenario to reproduce the issue in AS JBOSS 6.1.0.Final. This works fine in EAP 6.2.

      Deploy the ear that contains hello.war and goodbye.war.

      The log shows that only one bean is injected - only HelloWorld is injected and Goodbye is null.

      Now rename (or rebuild the ear with one war name changed) one of the war so that it is in different sorted order. (say hello.war to ahello.war or goodbye.war zgoodbye.war). When redeployed, now the HelloWorld is null and Goodbye is injected.

       

      The project structure is as follows.

      The maven source to build the project is attached.

       

      hello_EAR.ear

          +META-INF

              application.xml

          +hello.war

              +WEB-INF

                  classes

                      com.hello.HelloWorldServlet.class

                      com.hello.HelloWorld.class

                  web.xml

                  beans.xml

               META-INF

           +goodbye.war

                +WEB-INF

                 classes

                      com.hello.GoodbyeWorldServlet.class

                      com.hello.GoodbyeWorld.class

                 web.xml

                 beans.xml

              +META-INF

               

       

      This is a major bug.

      Is there a workaround so that all wars under ear can use CDI without any issue.

       

      Similar issue was reported before:CDI beans for multiple WARs in an EAR