1 Reply Latest reply on Nov 24, 2008 8:03 AM by troy.sellers

    Error running TestNG integration test using JBDS

    troy.sellers

      Hi All,


      I am trying to build a new project using SEAM, the JBDS created artifacts and then trying to mavenize this build.


      I am getting the following errors trying to run a simple test (just prints system.out) that was created in a package in the project-test.



      [Parser] Running:
        C:\projects\yum\codebase\MatadorLite-test\temp-testng-customsuite.xml
      
      FAILED CONFIGURATION: @BeforeSuite startSeam
      java.lang.IllegalStateException: duplicate factory for: org.jboss.seam.web.webSession (duplicate is specified in components.xml)
           at org.jboss.seam.core.Init.checkDuplicateFactoryExpressions(Init.java:222)
           at org.jboss.seam.core.Init.checkDuplicateFactory(Init.java:215)
           at org.jboss.seam.core.Init.addFactoryValueExpression(Init.java:278)
           at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1018)
           at org.jboss.seam.init.Initialization.init(Initialization.java:646)
           at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:920)
           at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
      ... Removed 15 stack frames
      SKIPPED CONFIGURATION: @BeforeClass setupClass
      SKIPPED CONFIGURATION: @BeforeMethod begin
      SKIPPED CONFIGURATION: @AfterMethod end
      SKIPPED CONFIGURATION: @AfterClass cleanupClass
      SKIPPED: test_varietyList
      
      ===============================================
          com.axegroup.MatadorLite.test
          Tests run: 1, Failures: 0, Skips: 1
          Configuration Failures: 1, Skips: 4
      ===============================================
      
      
      ===============================================
      MatadorLite-test by packages
      Total tests run: 1, Failures: 0, Skips: 1
      Configuration Failures: 1, Skips: 5
      ===============================================



      Can anyone explain what would be causing this?


      Cheers,
      Troy

        • 1. Re: Error running TestNG integration test using JBDS
          troy.sellers

          Hi,


          I have found a workaround, wouldn't call this a solution.


          If you migrate the bootstrap folder (this was created with seam-gen) into your project.
          Then update the pom.xml (we are using a single war deployment, we only have one pom)


          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
              <additionalClasspathElements>
                  <additionalClasspathElement>bootstrap</additionalClasspathElement>
              </additionalClasspathElements>
              <childDelegation>true</childDelegation>
              <useSystemClassLoader>true</useSystemClassLoader>
              </configuration>
          </plugin> 
          



          Add the necesarry dependencies


                      <dependency>
                        <groupId>org.testng</groupId>
                        <artifactId>testng</artifactId>
                        <version>5.8</version>
                        <scope>test</scope>
                        <classifier>jdk15</classifier>
                      </dependency>
                      <dependency>
                           <groupId>javassist</groupId>
                           <artifactId>javassist</artifactId>
                           <version>3.8.0.GA</version>
                        <scope>test</scope>
                      </dependency>  
                      <dependency>
                           <groupId>javax.el</groupId>
                           <artifactId>el-api</artifactId>
                           <version>1.0</version>
                        <scope>test</scope>
                      </dependency>  
                      <dependency>
                          <groupId>javax.ejb</groupId>
                           <artifactId>ejb-api</artifactId>
                           <version>3.0</version>
                        <scope>provided</scope>
                      </dependency> 
          



          This allowed me to run a maven build with the TestNG setup.


          I am pretty sure it is a nasty hack, but I couldn't figure out how to reference the -test project that is created by seam-gen.  When I was running my tests from this project I was still getting the duplicate factory exception.  I am guessing this was because I had a project dependency for SEAM and also was referencing the main project?.


          Anyways... if anyone wanders past this post and would like to let me know where I might have been going wrong, would be appreciated.


          Cheers,
          Troy