但是出现: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
的错误,求高手帮忙看看肿么回事???谢谢
servelt初始化方法init()里边也要加上context初始化的代码
web.xml里边加上
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
Servlet的初始化方法init()里加上
ServletContext servletContext = this.getServletContext();
applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
别忘引入相应的jar包追问
我是这样配置的,请问哪里需要添加丫,怎么添的呢?谢谢大神。。。
里的路径改为相对路径试试,
/WEB-INF/applicationContext.xml
看你错误应该是这个路径不对,具体路径你去tomcat的webapps下找相应的工程,看你自己把这个xml放哪了,如果在src包就用/WEB-INF/classes/applicationContext.xml
您好,放在相对路径下面的话它找是找到这个文件了,但是出现了这样的问题:
请问是什么原因丫?看不明白,谢谢啊
你的applicationContext.xml到底放在哪个位置,把工程package截图贴出来