zoukankan      html  css  js  c++  java
  • class path resource [applicationContext.xml] cannot be opened because it does not exis

    使用maven创建web工程,将spring配置文件applicationContext.xml放在src/resource下,用eclipse编译时提示class path resource [applicationContext.xml] cannot be opened because it does not exist错误。但是用mvn clean package命令编译时成功的。web.xml配置的如下

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    用google搜索一下(之前google用不了,用百度搜到蛋疼),发现是由于classpath不是指向resource路径,导致一直找不到文件。需要在classpath后面加个*,这样就解决问题了。

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext.xml</param-value>
    </context-param>

  • 相关阅读:
    Postfix邮件服务
    Python
    LVS
    MFS
    Apache
    Zookeeper集群 + Kafka集群 + KafkaOffsetMonitor 监控
    shell 检测安装包
    shell ssh 批量执行
    shell 判断脚本参数
    bzoj 1500 修改区间 splay
  • 原文地址:https://www.cnblogs.com/sharpest/p/6009740.html
Copyright © 2011-2022 走看看