I have an application that supports a business delegate EJB and MDBs. These components utilize beans created from an application context. A single root config xml file imports all files needed by these beans. A ClassPathXMLApplicationContext is contructed, passing in this root config file. The xml files and the associated beans are deployed to the EJB classloader. This all works fine and as expected.
I encountered issues however when adding a web application. I'm using echo2 as the gui framework for the Web and get the web application context from
org.springframework.context.ApplicationContext context = WebApplicationContextUtils.getWebApplicationContex t(servletContext);
The echo2 beans instantiate nicely from this context.
I encountered a problem when referencing bean definintions deployed on the EJB classloader from the web application context. I wasn't really sure how to link the two different contexts in different classloaders, so I imported the root config XML file into the web application context xml file. Now all the web GUI components can see the required bean definitions.
Well, there surfaced yet another problem when implementing an editor used for changing bean values instantiated by Spring. The beans are defined as a singleton; but I am getting two instead of one instance. It looks like the Web based editor is editing the instance that is created in the web classloader; but the process that consumes the bean, which requires the changes, uses an instance in the EJB classloader.
I've tried a few things to try as resolve this but to no avail. I'm not sure where to go from here. I don't see a way to programatically join the two contexts after they are instantiated and the EJB context doesn't know about the web context when it gets intantiated, so I don't think heiarchical context can be used.
I've seen some related problems logged on this site; but the solution for my case wasn't clear to me. I'm relatively new to Spring...
Any assistance would be greatly appreciated.
I've tried looking at the locator; but still not sure how to join the two contexts. I also thought about deploying everything on the EJB classloader and using a singleton to access the Echo2 beans from within the web tier; but that seems like a violation of the web / ejb boundaries. I would like to keep the two seperated....