Hi,
> I'm trying to get the spring context loading in my tests using the examples
> from Freddy's book. Basically I've got this in my test:
>
> mockServletContext.addInitParameter("contextConfigLocation",
> "/WEB-INF/applicationContext.xml");
> ContextLoaderListener springContextLoader = new
> ContextLoaderListener();
> springContextLoader.contextInitialized(new
> ServletContextEvent(mockServletContext));
>
> And I'm getting a FileNotFound down in spring's XmlBeanDefinitionReader. At
> first I thought this would be as simple as changing my working directory to
> be the maven target/myapp directory, since that's the parent of WEB-INF at
> runtime, but that did change the behavior.
>
> Any other ideas? Seems like its probably something pretty basic, and its just
> too late for me to see it..
This used to happen to me too, so I just pass the absolute paths to the
servletContext. See snippet:
String ctx = null;
for (String contextLocation : contextLocations) {
File f = new File(contextLocation);
if (ctx == null) {
ctx = f.getAbsolutePath();
}
else {
ctx += ",\n" + f.getAbsolutePath();
}
}
log.info("Got context locations for servlet context: " + ctx);
servletContext.addInitParameter("contextConfigLocation",ctx);
contextLocations is just a String[] array containing the relative paths of all
files to load.
Hope this helps,
Florian
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users