0 Replies Latest reply on Apr 25, 2008 4:27 PM by JB Arnoux

    Integration test, Error while extending SeamTest

    JB Arnoux Newbie

      Hello i would like to make Integrations tests for my Seam Statefull Bean and i have error that i can't solve, despite my research.

      I have a Seam EJB, wich contains a POJO, wich contains my EntityBean.

      public class EJBSeam implements
              EJBSeamLocale {
          private static final Logger aLogger =
          @PersistenceContext(type = PersistenceContextType.EXTENDED, unitName = "MyUnitName")
          private EntityManager em;
          @In(required = false)
          @Out(required = false)
          private APojo myPojoWichContainsEJBEntity;
          private AnInterfaceLocal MyEJBActions;
          private Boolean actionPossible;
          private String errorMessage;

      If I code an Integration Test wihtout extending SeamTest and without JSF actions, it works.

      public class TestCFA {
          private EntityManagerFactory emf;
          private EJBActionClass anEJB;
          private EntityManager em;
          public void init() {
              emf = Persistence.createEntityManagerFactory("formCoTestUnit");
       private void initEJB() {
              em = emf.createEntityManager();
              EJBSeam myEjbSeam= new EJBSeam();
              EJBActionClass  ejbAction = new EJBActionClass();
       public void testPrepareAdd() {
              assert "addInitialized".equals(myEjbSeam.prepareAddSomething());
          public void destroy() {
              System.out.println("aprs test");

      If I extends SeamTest with the same code, I obtain this error:

      DEBUG [main] (Lifecycle.java:261) - End of session, destroying contexts
      FAILED CONFIGURATION: @AfterMethod end
              at org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:48)
              at org.jboss.seam.Component.forName(Component.java:1579)
              at org.jboss.seam.Component.getInstance(Component.java:1627)
              at org.jboss.seam.Component.getInstance(Component.java:1622)
              at org.jboss.seam.Component.getInstance(Component.java:1599)
              at org.jboss.seam.Component.getInstance(Component.java:1594)
              at org.jboss.seam.core.ConversationEntries.instance(ConversationEntries.java:91)
              at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:284)
              at org.jboss.seam.mock.SeamTest.end(SeamTest.java:676)
      ... Removed 24 stack frames

      I read the posts about this error, but anything i tried don't solve my problem.
      I have Seam 1.2.1GA, TestNG 5.7 with Eclipse plugin.
      I moved all -embedded.jar files in first position in the classpath without result.
      I don't have two Seam jar files in the same classpath.

      If anyone could help me...
      Thanks in advance.