1 Reply Latest reply on Nov 29, 2006 1:08 AM by Stuart Robertson

    @PostConstruct on SessionBeanInterceptor is never called?

    Stuart Robertson Novice

      I'm running 1.1CR2 in embedded mode (TestNG). All of the plumbing seems to be working fine, except Seam components that are EJBs are never getting initialized (Component.initialize() is not called - seems like it's intended to be done by SessionBeanInterceptor.postConstruct). Looking closely through the Seam code, I'm not sure how it's supposed to work.

      In this case I have the following component defined:

      23:13:27,039 INFO [Component] Component: test, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: com.feedbuilders.core.business.TestAction, JNDI: TestAction/local
      23:13:27,043 DEBUG [Component] interceptor stack: [Interceptor(org.jboss.seam.interceptors.ConversationInterceptor), Interceptor(org.jboss.seam.interceptors.OutcomeInterceptor)]
      


      In my test I invoke it like this:

       new FacesRequest() {
       @Override
       protected void invokeApplication()
       {
       System.out.println("invokeApplication");
       invokeMethod("#{test.addFeedData}");
       }
      


      The component itself is defined like this:

      @Stateless
      @Name("test")
      public class TestAction implements Serializable, Test {
      
       @Logger private Log log;
      


      The logger is never injected. Tracing through the ClientSideInterceptor it looks like the SessionBeanInterceptor is ThreadLocal, and only wraps a bean during the invocation (so postCreate wouldn't be called by the EJB container, right?). I added a @PostCreate method to the TestAction directly and it was correctly called by the EJB container. Which I think I saw in the spec means it's the only one being called.

      Am I doing something wrong here? I've looked into everything I can think of (seam docs, seam book, ejb spec, lots of time in the debugger), and am now stumped. I didn't see any of the example apps using @Logger, which is injected in Component.initialize(), so I wonder if this is also happening in the example apps.

      Any insight would be much appreciated!