3 Replies Latest reply on Jun 12, 2007 2:24 PM by Sheldon s

    Trouble with SeamTest when stateful session bean is annotate

    Sheldon s Newbie

      I couldn't get the SFSB to instantiate correctly in my SeamTest because the component startup was invoked before the embedded ejb container startup. Here is the error message:


      org.jboss.seam.InstantiationException: Could not instantiate Seam component: companyList
      at org.jboss.seam.Component.newInstance(Component.java:1740)
      at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
      at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
      at org.jboss.seam.init.Initialization.init(Initialization.java:504)
      at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
      Caused by: javax.naming.NamingException: Local server is not initialized
      at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.<init>(InitialContext.java:197)
      at org.jboss.seam.util.Naming.getInitialContext(Naming.java:35)
      at org.jboss.seam.util.Naming.getInitialContext(Naming.java:47)
      at org.jboss.seam.Component.instantiateSessionBean(Component.java:1107)
      at org.jboss.seam.Component.instantiate(Component.java:1093)
      at org.jboss.seam.Component.newInstance(Component.java:1736)



      Here is the log message after I disabled the @Startup annotation of the SFSB:

      15:31:44,187 INFO [Lifecycle] starting up: org.jboss.seam.servlet.exceptionFilter
      15:31:44,187 INFO [Lifecycle] starting up: org.jboss.seam.ioc.spring.springELResolver
      15:31:44,218 INFO [Lifecycle] starting up: org.jboss.seam.ui.resource.webResource
      15:31:44,218 INFO [Lifecycle] starting up: org.jboss.seam.servlet.redirectFilter
      15:31:44,218 INFO [Lifecycle] starting up: org.jboss.seam.core.ejb
      15:31:44,218 INFO [Ejb] starting the embedded EJB container
      15:31:45,328 WARN [BeanSchemaBinding] You should use the 2.0 version of the Microcontainer xml. xmlns='urn:jboss:bean-deployer:2.0'
      ...


      Is there a way I can postpone the startup of this EJB while keeping the @Startup annotation?

      Thanks.