Spring,找不到applicationContext.xml的解决办法

Spring,找不到applicationContext.xml的解决办法

报错:
nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist

解决方法,有1种,参考了网上的解决办法,忘了网址:
通常我们配置spring上下文是在web.xml这样配置的,之后报如上错误:
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml /WEB-INF/applicationContext-hibernate.xml
   /WEB-INF/applicationContext-dataSourceJNDI.xml
  </param-value>
</context-param>

改为以下的配置方式:
  <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml,classpath:applicationContext-hibernate.xml,
   classpath:applicationContext-dataSourceJNDI.xml
  </param-value>
  </context-param>

注意:改为这种方式后把这3个文件都放在classes/目录下。问题解决


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/rainv/archive/2007/02/08/1505768.aspx

你可能感兴趣的:(spring,xml,Hibernate,Web,.net)