1 Reply Latest reply on Dec 10, 2012 3:33 PM by javacoryd

    Seam 2.3 with Arquillian

    javacoryd

      I'm in the process of migrating a Seam 2.1 application which has component tests to Seam 2.3 with Arquillian.  We are targeting JBoss 7 as our deployment platform.

       

      In doing so, I have generated an application using seam-gen just to get a feel for how the app deploys, ear structure, etc.  I have built the EAR from the project have have successfully deployed the application to JBoss 7.1.1 Final.

       

      In my test, I have code like the following which creates the same EAR deployment from the exploded version of the ear.  When I run the test, I can see that my resources were added to the EnterpriseArchive, but during deployment

      the EAR fails to deploy.  When looking further with the debugger, Seam gets started and initialization fails because it is trying to deploy the war file within the EAR, but can't find the WEB-INF/components.xml.  If I look at the JBoss

      directory which contains the deployment, there isn't anything in the WAR.

       

      So, it seems like ShrinkWrap isn't creating the EAR correctly???  I'm using the ShrinkWrap libs that came with the Seam 2.3 distribution.

       

      All of the ShrinkWrap EAR creation examples that I have seen seem to create the EAR from scratch, which doesn't make sense to me.

       

      Thanks,

       

      Cory.

       

      @Deployment(name="ArquillianDummyTest")

      @TargetsContainer("jboss")

          public static EnterpriseArchive createDeployment() {

       

              EnterpriseArchive theEar = ShrinkWrap

                      .create(ExplodedImporter.class, "some.ear")

                      .importDirectory(

                              "C:/dev/workspaces/JBoss7/epic/deploy_export/some.ear/")

                      .as(EnterpriseArchive.class);

       

              System.out.println(theEar.toString(true));

             

              return theEar;

       

          }

        • 1. Re: Seam 2.3 with Arquillian
          javacoryd

          So, after 2 days of trying to figure this out I found some sort of solution for this to at least get past this.  So I have a simple ear with this layout:

           

          some.ear

               - some.war

                  ....

               - some.jar

                  ....

           

          This structure was exploded out like this in my "deploy_export" folder.  I was hoping ShrinkWrap would take this structure and create the ear from it.  However, it seems that for some reason, the sub-archives are not deployed correctly by creating the deployment this way.  So, what I did was removed the war and the jar from the ear structure and put them into their own exploded directory.  I then executed this deployment logic instead which makes calls to add the war and jar as a module.  This deployed correctly.

           

          EnterpriseArchive theEar = ShrinkWrap

                          .create(ExplodedImporter.class, "some.ear")

                          .importDirectory(

                                  "C:/dev/workspaces/JBoss7/epic/deploy_export/some.ear/")

                          .as(EnterpriseArchive.class);

           

                  WebArchive theWar = ShrinkWrap

                          .create(ExplodedImporter.class, "some.war")

                          .importDirectory(

                                  "C:/dev/workspaces/JBoss7/epic/deploy_export/some.war/")

                          .as(WebArchive.class);

                 

                  JavaArchive theJar = ShrinkWrap

                          .create(ExplodedImporter.class, "some.jar")

                          .importDirectory(

                                  "C:/dev/workspaces/JBoss7/epic/deploy_export/some.jar/")

                          .as(JavaArchive.class);

                  theJar.addClass(ArquillianTest.class);

           

                  theEar.addAsModule(theWar);

                  theEar.addAsModule(theJar);

           

                  System.out.println(theEar.toString(true));

           

                  return theEar;