2 lihuozhiling lihuozhiling 于 2013.11.29 11:06 提问

Spring mvc mybatis 核心文件applicationContext.xml读取路径的问题

我搭了一个框架,applicationcontext.xml文件不在src下也不在WEB-INF/classes下而是在WEB-INF/etc下(自己建的文件夹) 现在我的java类中想获取spring容器applicationContext 对象,核心xml文件总是说路径不对,试了好几种了,真心的求大神~~~~~

严重: Servlet.service() for servlet [dispatcher] in context with path [/shweb1] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\free\eclipse-server\WebContent\WEB-INF\etc\spring\applicationContext.xml]; nested exception is java.io.FileNotFoundException: WebContent\WEB-INF\etc\spring\applicationContext.xml (系统找不到指定的路径。)] with root cause
java.io.FileNotFoundException: WebContent\WEB-INF\etc\spring\applicationContext.xml (系统找不到指定的路径。)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at org.springframework.core.io.FileSystemResource.getInputStream(FileSystemResource.java:110)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:458)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:388)
at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
at dao.DaoFactory.getDaoFactory(DaoFactory.java:12)
at domain.User.(User.java:13)
at web.controller.LoginController.view(LoginController.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke

Csdn user default icon
上传中...
上传图片
插入图片