Thank you for your reply. Yes, I had read both threads. I eventually created two contexts (one for web and the other for jar) and jar context is a parent of web app context now.
I didn't know <ref> has "parent" attribute, but everything now worked out.
After I checked the server log, however, I found out that jar context was created twice along with all beans as web app started and MDB was processed. My app runs on single machine with single JVM, and I'd like to avoid this unnecessary resource allocation.
How can MDB get a root context that has been already created? Here is my MDB code. I have beanRefContext.xml in root classpath (default), so I didn't pass any args to a getInstance method. This works fine except that it creates a new context. Yes, it creates only once (all MDBs share it), but the same context was already created as a web app started.
I'm using JBoss 4.x. Is this a class loader issue?
BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance();
BeanFactoryReference ref = locator.useBeanFactory("myContextId");
Again, thank you for your support.