[jboss-user] [EJB 3.0 Development] New message: "Re: Lookup to java:comp/EJBContext during postconstruction"

jaikiran pai do-not-reply at jboss.com
Wed Mar 10 03:13:07 EST 2010


User development,

A new message was posted in the thread "Lookup to java:comp/EJBContext during postconstruction":

http://community.jboss.org/message/530970#530970

Author  : jaikiran pai
Profile : http://community.jboss.org/people/jaikiran

Message:
--------------------------------------------------------------
> jaikiran wrote:
>  And i don't think it's specific to the EJBContext. I guess it will fail for anything under java:comp for that bean. Can you give a quick try by looking up something else under java:comp from within the @Postconstruct of MDB?
Looked at that stacktrace again and it indeed appears to be specific to java:comp/EJBContext
 
 
Caused by: java.lang.NullPointerException
     at org.jboss.ejb3.EJBContextFactory.getObjectInstance(EJBContextFactory.java:57)
     at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
     at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)
     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)
 
 
 
 

 
 
It appears that the AbstractPool invokes the postconstruct after popping the context from the thread local stack:
 
protected BeanContext<?> create(Class[] initTypes, Object[] initValues)
   {
      BeanContext ctx;
      ctx = createBeanContext();
      container.pushContext(ctx);
      try
      {
         container.injectBeanContext(ctx);
 
         ctx.initialiseInterceptorInstances();
 
      }
      finally
      {
         container.popContext();
      }
 
      container.invokePostConstruct(ctx, initValues);
 
      // the init method only applies to stateful session beans
 
      ++createCount;
 
      return ctx;
   }

 
 
The fix looks simple enough. I'll file a JIRA for this.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/530970#530970




More information about the jboss-user mailing list