PDA

View Full Version : How come the ClassPathXmlApplicationContext can not find a file?


vw729
Aug 8th, 2007, 02:09 PM
I have a servlet for image display. To plug in a bean defined in Spring configuration files, I use the same approach shown in the "Pro Spring" as the followings:


new ClassPathXmlApplicationContext("/WEB-INF/applicationContext-hibernate.xml");


And I get an exception on file not found error.


ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].log:675 - StandardWrapper.Throwable
org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [WEB-INF/applicationContext-hibernate.xml]; nested exception is java.io.FileNotFoundException: class path resource [WEB-INF/applicationContext-hibernate.xml] cannot be opened because it does not exist
java.io.FileNotFoundException: class path resource [WEB-INF/applicationContext-hibernate.xml] cannot be opened because it does not exist


The file is under WEB-INF. What I am missing here?

Thanks for your inputs.