I'm trying to test my command object from my web application. I need to setup the Spring context, so I've been following an example out of Matt Raible's Spring Live. I have added the following code to my setUp() of my test case.
My problem is that no matter what I put in path, I get the following exception.Code:String path[] = {"/src/tests/applicationContext.xml"}; ctx = new XmlWebApplicationContext(); ctx.setConfigLocations(path); ctx.setServletContext(new MockServletContext("")); ctx.refresh();
Yet, when I change this toCode:Aug 25, 2004 4:32:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from resource [/../applicationContext.xml] of ServletContext Aug 25, 2004 4:32:39 PM org.springframework.mock.web.MockServletContext getResourceAsStream SEVERE: Couldn't open resource class path resource [../applicationContext.xml] java.io.FileNotFoundException: Could not open class path resource [../applicationContext.xml]It finds applicationContext.xml without a problem. Does anyone have a suggestion of what I'm doing wrong?Code:ac = new FileSystemXmlApplicationContext("src/tests/applicationContext.xml");


Reply With Quote