使用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>

class path resource [applicationContext.xml] cannot be opened because it does not exis的更多相关文章

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

    感谢:http://blog.chinaunix.net/uid-20681545-id-184633.html提供的解决方案,非常棒 ! 问题说明: 新建一个Spring项目,新建一个Bean类:H ...

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

    org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may ...

  3. Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope

    1.错误描述 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.tes ...

  4. org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: c

    //这个是 配置文件放错了地方 org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing ...

  5. 项目中运行报错: Loading XML bean definitions from class path resource [applicationContext.xml]

    记录一下: org.springframework.context.support.AbstractApplicationContext prepareRefresh Refreshing org.s ...

  6. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; neste

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...

  7. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...

  8. aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method fai

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...

  9. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable t

    spring与hibernate整合然后出现如下错误: org.springframework.beans.factory.BeanCreationException: Error creating ...

随机推荐

  1. [BZOJ1718]:[Usaco2006 Jan] Redundant Paths 分离的路径(塔尖)

    题目传送门 题目描述 为了从F个草场中的一个走到另一个,贝茜和她的同伴们有时不得不路过一些她们讨厌的可怕的树.奶牛们已经厌倦了被迫走某一条路,所以她们想建一些新路,使每一对草场之间都会至少有两条相互分 ...

  2. git连接远程仓库时,出现“ Repository not found"的解决办法

    2018-08-25 今天连接远程仓库时,出现: 原来是远程仓库地址名字错了. 解决方法: 1.找到.git目录 2.进入.git找到config文件 3.修改config里面的远程地址url

  3. 构造Map并对其排序

    #构造Map并对其排序 attr_tul = ['a','b','c','d','e','f'] one_tul = [,,,,,] one_dic = {} for i in range(len(a ...

  4. sqlalchemy.exc.InvalidRequestError: Table 'run_result' is already defined for this MetaData instance

    临时解决办法: 在models文件导入db后,加上如下代码: db.metadata.clear() 但解决问题的根本之处还是在于找到,为何会声明了2次类的定义呢? 解析: table 'roles_ ...

  5. Win7上防火墙开放FTP服务以及ping解决方案

    1.windows 防火墙开放ftp服务 The following 4 steps will allow both non-secure and SSL FTP traffic through fi ...

  6. java网络通信:同步阻塞式I/O模型(BIO)

    缺点:一个线程只能处理一个客户端连接 服务端: public class TimeServer { public static void main(String[] args) throws IOEx ...

  7. Python Module_Socket_网络编程

    目录 目录 Socket 套接字 套接字的原理 套接字的数据处理方式 套接字类型 Socket 标准函数 ServerSocket 标准函数 ClientSocket 标准函数 公有标准函数 Sock ...

  8. 阶段3 1.Mybatis_01.Mybatis课程介绍及环境搭建_02.三层架构和ssm框架的对应关系

  9. 【工具使用】kali 安装后要做的事情

    日期:2019-07-17 10:43:40 介绍:修改分辨率.修改时区.修改源 0x01. 修改分辨率 kali 在安装完成之后,分辨率过低,需要修改分辨率.  然后依次选择 [settings] ...

  10. 什么是SLF,PSL,MLF,SLO?

    受国际经济金融形势不确定性增强以及各种影响流动性的因素波动较大影响,近年来我国银行体系短期流动性供求的波动性有所加大,尤其是当多个因素相互叠加或市场预期发生变化时,有可能出现市场短期资金供求缺口难以通 ...