Issue Details (XML | Word | Printable)

Key: EQX-32
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Matt Raible
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse Light

ContextLoaderPlugIn creates duplicate ApplicationContext

Created: 14/Sep/05 02:09 PM   Updated: 17/Dec/05 07:13 PM   Resolved: 17/Dec/05 07:13 PM
Return to search
Component/s: Web - Struts
Affects Version/s: 1.3
Fix Version/s: 1.5


 Description  « Hide
Moved from java.net: https://equinox.dev.java.net/issues/show_bug.cgi?id=19

ContextLoaderPlugIn is configured in struts-xonfig.xml like this:

    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation"
            value="/WEB-INF/applicationContext-hibernate.xml,
                   /WEB-INF/applicationContext.xml,
                   /WEB-INF/action-servlet.xml"/>
    </plug-in>

However, this creates a second ApplicationContext as child of the main
ApplicationContext (created by ContextLoaderListener in web.xml). This means
that all beans in /WEB-INF/applicationContext*.xml will be instanciated twice
which can cause touble with OpenSessionInViewFilter because there are now two
SessionFactories.

Solution: Remove /WEB-INF/applicationContext-hibernate.xml and
/WEB-INF/applicationContext.xml from ContextLoaderPlugIn. See
http://forum.springframework.org/viewtopic.php?t=931#4094 for details.


------- Additional comments from mraible Tue Aug 23 04:15:38 +0000 2005 -------
You are correct that the applicationContext-hibernate.xml and
applicationContext.xml files are getting loaded twice. I agree this a bug.
However, if I remove these files from the ContextLoaderPlugin definition - then
the tests will fail b/c StrutsTestCase does not initialize listeners. I know
how to do a bridge between's Spring Mocks and StrutsTestCase, but I haven't done
it yet for Equinox.

Thanks for pointing this out - I'll try to figure out the best way to fix it in
the next release.

Sort Order: Ascending order - Click to sort in descending order
Matt Raible added a comment - 17/Dec/05 07:13 PM
This bug was caused because extras/struts/build.xml was not removing the <listener> from web.xml. I changed things to leave the listener instact and only load action-servlet.xml with the plugin. As far as testing, I created a BaseStrutsTestCase that loads the backend Spring context files and stuffs them into the servlet context - since StrutsTestCase doesn't initialize listeners.

Matt