Community

When is a bean moved to STARTED state?

created by jaikiran pai in JBoss Microcontainer - View the full discussion

This question relates to a thread in JBoss AS forum where a user is running into error trying to setup a dependency between a web application and an EJB http://community.jboss.org/message/534413#534413

 

Here's a brief overview:

 

1) A web app adds a < depends> in its jboss-web.xml to mark a dependency on a EJB container (which is a MC bean). The web app internally looks up the bean from JNDI and hence this dependency.

2) The EJB container (MC bean) has a "start()" lifecycle callback method (among other similar lifecycle callbacks).

3) In its start(), the EJB container *first* deploys some other MC beans and *then* binds the EJB proxies to JNDI.

 

When EJB container deploys some other MC beans in step#3, it results in MC resolving dependencies of other unrelated beans (known issue). Incidentally, while doing so, MC considers that the EJB container MC bean has been started even though the start() lifecycle method hasn't yet finished. MC then goes on to push the web-app to its next state considering the dependency has been fulfilled (which hasn't yet been fulfilled because the JNDI bindings in step#3 are not yet done). This results in the web-app running into NameNotFoundExceptions.

 

Does MC set the state to START even before the start() lifecycle successfully completes?

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community