Announcement Announcement Module
No announcement yet.
Context Creation with AbstractMDB Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Context Creation with AbstractMDB

    We have a Web application that has a rather hefty ApplicationContext that loads via the normal ContextLoaderListener.

    Next up, we have a few MDBs that we need to setup that also needs the use of the beans in this ApplicationContext. We noticed that every time ejbCreate is called on the MDB, that AbstractMDB creates the ApplicationContext from our definition files. This seems to be a very resource exspensive setup.

    Is there a way for the MDBs and the Web app to share a common ApplicationContext? I looked at and the threads it references. And I basically understand what the SingletonBeanFactoryLocator is doing, but I am trying to understand where to instantiate it. And how I would get AbstractMDB to use it?

    Last edited by robyn; May 19th, 2006, 06:28 AM.

  • #2
    I've just created IntraVMInvokerProxyFactoryBean and IntraVMInvokerServiceExposer which allows communication between application contexts in different web applications in the same thread. They are probably going to be added to the sandbox any day now. Because two web application do not use the same class loader serialization is required when passing objects from one web application to the other and back.

    I also suggested to create a LocalInvokerProxyFactoryBean and LocalInvokerServiceExporter. Web applications that are depolyed in an EAR package together with a EJB part typically have a class loader that has the EJB part class loader as its parent which allows you to do what IntraVMInvoker does without serialization (if the classes you send back and forth are deployed in APP-INF/lib). This would allow you to get an exported service from a session bean or message driven bean like this:

    MyService myService = (MyService)LocalInvokerProxyFactory.getProxy(MyService.class);
    If you're interested I can write this over the weekend. The advantage would be that you can reuse your application context created by ContextLoaderListener in the EJB part of your EAR.