1 Reply Latest reply on Jul 20, 2009 6:26 PM by Aaron Meyer

    Seam testing+Duplicate factory for: org.jboss.seam.web.webSession (duplicate is specified in components.xml)

    dsfds dgd Newbie
      I try to test Seamdiscs provided by jboss-seam-2.1.2.CR2/examples/seamdiscs/, when I run TestNG testing, I get the errors like "Duplicate factory for: org.jboss.seam.web.webSession (duplicate is specified in components.xml)". I have searched around Internet, no solutions for it. Please help.  Details are as follows:

      ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] schema export unsuccessful
      org.hibernate.JDBCException: Error during import script execution

      ...

      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:227)
              at org.jboss.seam.core.Init.checkDuplicateFactory(Init.java:220)
              at org.jboss.seam.core.Init.addFactoryValueExpression(Init.java:283)
              at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1152)
              at org.jboss.seam.init.Initialization.init(Initialization.java:733)
              at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:919)
              at org.jboss.seam.mock.DBUnitSeamTest.startSeam(DBUnitSeamTest.java:56)
      ... Removed 15 stack frames


      My components.xml is as follows:

      <components ...
              <core:init debug="false" jndi-pattern="@jndiPattern@" />

              <core:manager concurrent-request-timeout="500"
                      conversation-timeout="120000"
                      conversation-id-parameter="cid"/>

              <persistence:managed-persistence-context name="entityManager"
                      auto-create="true"
                      persistence-unit-jndi-name="java:/seamdiscsEntityManagerFactory" />

              <security:identity
                      authenticate-method="#{authenticator.authenticate}" />

          <event type="org.jboss.seam.security.notLoggedIn">
              <action execute="#{redirect.captureCurrentView}"/>
          </event>
         
          <event type="org.jboss.seam.security.loginSuccessful">
              <action execute="#{redirect.returnToCapturedView}"/>
          </event>
       
              <framework:entity-query name="discs" ejbql="select disc from Disc disc" order="disc.name ASC" max-results="5"/>
             
              <framework:entity-query name="artists" ejbql="select artist from Artist artist" order="artist.name DESC" max-results="5">
            <framework:restrictions>
              <value>lower(artist.name) like lower(concat(#{exampleArtist.name}, '%'))</value>
            </framework:restrictions>
          </framework:entity-query>
             
              <framework:entity-query name="allArtists" ejbql="select artist from Artist artist" order="artist.name"/>
             
              <framework:entity-home entity-class="org.jboss.seam.example.seamdiscs.model.Disc" name="discHome"/>
             
              <factory name="disc" value="#{discHome.instance}"/>
       
              <component name="exampleArtist" class="org.jboss.seam.example.seamdiscs.model.Artist" scope="session" />

              <transaction:ejb-transaction/>
      </components>