SpringMVC web项目启动报错:

严重: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [springMVC-servlet.xml]; nested exception isjava.io.FileNotFoundException: class path resource [springMVC-servlet.xml] cannot be opened because it does not exist


这里写一下有关DispatcherServlet前端控制器配置文件的编写和存放位置
1、servlet标签下的init-param标签是为配置文件指定新的位置,如果配置文件xxx-servlet在默认配置文件下即在WEB-INF下就尽量不要配init-param了,配置反而会出错
2、如果是配置文件放在WEB-INF默认读取地址需要遵循xxx-servlet.xml的命名格式;且xxx要和servlet-name>springMVC</servlet-name 里的值一样
3、如果没把配置文件xml放在默认目录下(WEB-INF),就配上init-param,告诉服务器去哪找配置文件;此时的配置文件名可以自己定义

web.xml中
<servlet><servlet-name>springMVC</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!-- 为配置文件指定新的位置,如果配置文件xxx-servlet在默认配置文件下即WEB-INF下就尽量不要配了,配置反而会出错 --><!-- <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:springMVC-servlet.xml</param-value> </init-param> --><load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping><servlet-name>springMVC</servlet-name><url-pattern>/</url-pattern>
</servlet-mapping>

class path resource [springMVC-servlet.xml] cannot be opened because it does not exist相关推荐

  1. class path resource [a.hbm.xml] cannot be opened because it does not exist

    大家好,我是mythSun. 很高兴能在这里和大家分享,怎么来解决 class path resource [a.hbm.xml] cannot be opened because it does n ...

  2. 关于class path resource [mapper/*Mapper.xml] cannot be opened because it does no exists

    关于class path resource [mapper/*Mapper.xml] cannot be opened because it does no exists异常的一些记录 这是用spri ...

  3. java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be opened

    一般来说路径问题. 我检查了web.xml的行,发现我设置的是固定的springmvc,但我实际命名为springMVC,当然报错. 其实报错了通过耐心翻译很容易看出问题,path resource ...

  4. nested exception is java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be ope

    根据 提示 ,逐步解决bug,逐层推进:比如,有一个错是IOException异常,Springmvc.xml找不到,就需要去找下是否有配置文件,如果有,怎么回事?第二次再深入发现是target下没有 ...

  5. 报错解决:IOException parsing XML document from class path resource [spring-mvc.xml]

    今天在创建一个springmvc的项目的时候,我碰到了页面上的报错: IOException parsing XML document from class path resource [spring ...

  6. Web开发:class path resource [com/xxx/entity/User.hbm.xml] cannot be opened because it doesn't exist

    1 前言 最近在教人使用SpringMVC,在运行过程中,有不少人遇到了这个问题,即"class path resource [com/xxx/entity/User.hbm.xml] ca ...

  7. class path resource [beans.xml] cannot be opened because it does not exist

    严重: Exception sending context initialized event to listener instance of class org.springframework.we ...

  8. Error creating bean with name 'dataSource' defined in class path resource [spring/spring-dao.xml]:

    Error creating bean with name 'dataSource' defined in class path resource [spring/spring-dao.xml]: B ...

  9. Line 8 in XML document from class path resource [conf/applicationContext.xml] is invalid

    @[TOC**] 错误:Line 8 in XML document from class path resource [conf/applicationContext.xml] is invalid ...

  10. 关于sping使用springSecurity权限控制:Offending resource: class path resource [spring/spring-security.xml错误整理

    严重:Exception sending context initialized event to listener instance of class org.springframework.web ...

最新文章

  1. bzoj 2946 [Poi2000]公共串——后缀自动机
  2. cesium多边形描边_Cesium专栏-地形开挖2-任意多边形开挖(附源码下载)
  3. CS231n 2016 通关 第三章-SVM 作业分析
  4. PHP 实现代码复用的一个方法 traits新特性
  5. C# Datatable排序与取前几行数据
  6. iPhone手机更换自定义铃声
  7. Makefile中关于all和.PHONY
  8. 哥廷根大学计算机博士,德国哥廷根大学 单分子光学 招博士 (75% TV-L E13 工资)...
  9. CISCO常用配置命令
  10. 大数据资料和开发工具
  11. 中文分词(上)——获取和Word2Vec模型构建
  12. Unity面试题加强版之三《Unity脚本基础》
  13. matlab图像编码实验,数字图像处理实验和matlab程序代码数字图像处理实验.doc
  14. kaggle:NBA球员投篮数据分析与可视化(一)
  15. cost的导函数_几种常见函数的导数
  16. Springboot上传文件时提示405
  17. FZU1901 Period II
  18. 使用matla求取一维线性函数的系数
  19. 我国电子计算机诞生于,我国第一台电子计算机诞生于哪一年.doc
  20. 三大统计学相关系数(pearson皮尔森、spearman斯皮尔曼、kendall肯德尔)

热门文章

  1. 真机调试错误 Reason: image not found想到的
  2. android开发 问卷调查案例_基于Android的问卷调查系统模型分析与设计
  3. cocos2dx 3.9.1 mac模拟器log输出bug修正
  4. Python web客户端编程简单示例
  5. 黑帆第一季/全集Black Sails迅雷下载
  6. Virtual-Taobao: Virtualizing Real-World Online Retail Environment for Reinforcement Learning
  7. Linux网卡bond
  8. 常用标点符号中英文对照表
  9. 【Python军火库】smtplib+email:一起来用Python发送电子邮件吧!
  10. 4 款超级好用的终端文件管理器,提高你的使用效率!