Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
这是因为我把 [/WEB-INF/dispatcher-servlet.xml]的位置换成了[config/springmvc/dispatcher-servlet.xml]
因此idea在原来的位置找不到这个文件,怎么办呢

原来还是在web.xml里面做文章, 添加两行代码即可, 就是在dispatcher的servlet申明的时候, 添加初始化路径
源代码:
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>
修改后的代码:
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/springmvc/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>
之后, idea能找到dispatcher-servlet.xml文件, 问题解决!
参考资料: https://www.cnblogs.com/yxdz/p/7528351.html
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml]的更多相关文章
- Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/config/spring/applicationContext.xml]
在搭建SpringMVC框架的时候遇到了这个问题 问题的原因: 就是没有找到applicatoincontext.xml这个文件, 因为idea自动生成的路径不正确 因此需要再web.xml里面, ( ...
- 出错: IOException parsing XML document from ServletContext resource [/cn.mgy.conig]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/cn.mgy.conig]
错误的详细内容: 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanDefinitionStoreExceptio ...
- 关于SpringMVC项目报错:java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/xxxx.xml]
关于SpringMVC项目报错:java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/xxxx ...
- IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/app
web.xml初始化spring容器出错 org.springframework.beans.factory.BeanDefinitionStoreException: IOException par ...
- cxf(3.1.1) 异常Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml]
Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] ...
- 报错:Caused by: java.io.FileNotFoundException: d:\youTemprepository\upload_77faffc1_1580a9240ca__8000_00000001.tmp (系统找不到指定的路径。)
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-dat ...
- 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 ...
- Caused by: java.io.FileNotFoundException
1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...
- Caused by: java.io.FileNotFoundException: velocity.log (No such file or directory)
Caused by: org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initia ...
随机推荐
- 企业级SpringBoot与Dubbo的使用方式
企业级SpringBoot与Dubbo的使用方式 SpringBoot越来越热门以至于达到满大街可见的程度,而Dubbo这个基于二进制的微服务框架又捐献给Apache孵化,如果不会如何使用那么是不是很 ...
- lightoj1063【求割点】
题意不懂啊...... 只知道求割点. #include <bits/stdc++.h> using namespace std; typedef long long LL; typede ...
- HDU3415【单调队列】
单调队列解决通过维护满足条件内的值,并保证队列里的值单调,解决一个最大最小. 让你求一个k区间长度的最大值,那么就只要搞下前缀和, sum[ i , j ] 区间的和:sum[ j ]-sum[ i ...
- Bundle Adjustment光束平差法概述
http://blog.csdn.net/abcjennifer/article/details/7588865 http://blog.csdn.net/ximenchuixuezijin/arti ...
- gns3 拖出设备显示一个红色的s,无法启动虚拟设备
通过view-docks-调出console窗口,显示错误信息: Error while creating project: Can't connect to server http://172.0. ...
- JQuery中的$().each 以及 $.each的区别
最近一直在研究JS,今天看到遍历模块的时候,看到了这个函数: $(selector).each(function(index,element)) 但是想想,这个函数和之前项目里面用到的遍历数据的函数不 ...
- (bzoj1337 || 洛谷P1742 最小圆覆盖 )|| (bzoj2823 || 洛谷P2533 [AHOI2012]信号塔)
bzoj1337 洛谷P1742 用随机增量法.讲解:https://blog.csdn.net/jokerwyt/article/details/79221345 设点集A的最小覆盖圆为g(A) 可 ...
- python之模块random,time,os,sys,序列化模块(json,pickle),collection
引入:什么是模块: 一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 但其实import加载的模块分为四个通用类型. 1.使用python编写的代码(.py ...
- Java EE学习笔记(三)
Spring AOP 1.Spring AOP简介 1).AOP的全称是Aspect-Oriented Programming,即面向切面编程(也称面向方面编程).它是面向对象编程(OOP)的一种补充 ...
- JAVA常用知识总结(十二)——数据库(二)
MySQL主从热备份工作原理 简单的说:就是主服务器上执行过的sql语句会保存在binLog里面,别的从服务器把他同步过来,然后重复执行一遍,那么它们就能一直同步啦. 整体上来说,复制有3个步骤: 作 ...