jeff_duska
Aug 25th, 2004, 04:08 PM
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.
String path[] = {"/src/tests/applicationContext.xml"};
ctx = new XmlWebApplicationContext();
ctx.setConfigLocations(path);
ctx.setServletContext(new MockServletContext(""));
ctx.refresh();
My problem is that no matter what I put in path, I get the following exception.
Aug 25, 2004 4:32:39 PM org.springframework.beans.factory.xml.XmlBeanDefin itionReader 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]
Yet, when I change this to
ac = new FileSystemXmlApplicationContext("src/tests/applicationContext.xml");
It finds applicationContext.xml without a problem. Does anyone have a suggestion of what I'm doing wrong?
String path[] = {"/src/tests/applicationContext.xml"};
ctx = new XmlWebApplicationContext();
ctx.setConfigLocations(path);
ctx.setServletContext(new MockServletContext(""));
ctx.refresh();
My problem is that no matter what I put in path, I get the following exception.
Aug 25, 2004 4:32:39 PM org.springframework.beans.factory.xml.XmlBeanDefin itionReader 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]
Yet, when I change this to
ac = new FileSystemXmlApplicationContext("src/tests/applicationContext.xml");
It finds applicationContext.xml without a problem. Does anyone have a suggestion of what I'm doing wrong?