使用shiro 框架 报错No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?
1、问题描述:ssm 框架中使用shiro 中出现问题
原来web.xml 文件如下:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" metadata-complete="true">
<display-name>Archetype Created Web Application</display-name> <servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 配置springMVC需要加载的配置文件
spring-dao.xml,spring-service.xml,spring-mvc.xml
Mybatis - > spring -> springmvc
-->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-*.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<!-- 默认匹配所有的请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- 编码过滤器-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- 项目欢迎页面-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list> <!-- 基本知识: 现在在下面配置好过滤器的名字 + 哪些url 会进入当前的过滤器 -->
<!--过滤器: 你先配置一个过滤器 ,后配置一个过滤器, 那么url 就会先进入一个过滤器, 然后再进入另外一个过滤器 -->
<!-- shiro 为什么自己有一个过滤器呢:因为shiro框架是有做安全登录方面的功能实现的,所以他有一个自己的过滤器, 来对url进行过滤 -->
<!-- 如果没有自己的一个过滤器, 如何实现用户的验证授权等等-->
<!-- shiro的过滤器 -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
运行tomcat 显示报错如下:

2、解决方案:
然后对web.xml 进行修改,增加了下面红色的字体的内容, 解决问题
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" metadata-complete="true">
<display-name>Archetype Created Web Application</display-name> <servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 配置springMVC需要加载的配置文件
spring-dao.xml,spring-service.xml,spring-mvc.xml
Mybatis - > spring -> springmvc
-->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-*.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<!-- 默认匹配所有的请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- 编码过滤器-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- 项目欢迎页面-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list> <!-- 基本知识: 现在在下面配置好过滤器的名字 + 哪些url 会进入当前的过滤器 -->
<!--过滤器: 你先配置一个过滤器 ,后配置一个过滤器, 那么url 就会先进入一个过滤器, 然后再进入另外一个过滤器 -->
<!-- shiro 为什么自己有一个过滤器呢:因为shiro框架是有做安全登录方面的功能实现的,所以他有一个自己的过滤器, 来对url进行过滤 -->
<!-- 如果没有自己的一个过滤器, 如何实现用户的验证授权等等-->
<!-- shiro的过滤器 -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
3、问题探究:
报错信息里面显示:No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?
https://blog.csdn.net/zuoyexingchennn/article/details/50426869
https://www.cnblogs.com/JesseV/archive/2009/11/17/1605015.html
https://blog.csdn.net/Thousa_Ho/article/details/78464932
这三篇文章,应该是可以解决上面问题的原因, 但是我现在是个渣渣辉, 看不懂
使用shiro 框架 报错No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?的更多相关文章
- go语言,golang学习笔记3 用命令下载框架报错问题解决 设置环境变量
go语言,golang学习笔记3 用命令下载框架报错问题解决 设置环境变量 下载安装:go get github.com/astaxie/beego 首页 - beego: 简约 & 强大并存 ...
- Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误——SHH框架
SHH框架工程,Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误 1.查看配置文件web.xml中是否配置.or ...
- tomcat报错org.springframework.web.context.ContextLoaderListener找不到
tomcat报错org.springframework.web.context.ContextLoaderListener找不到. 最后解决办法:将jar包copy到web-inf下面的lib中. 你 ...
- Xcode8中添加SnapKit框架报错,编译失败
既然SnapKit的作者说SnapKit已经支持Swift3.0了,那么我们就先来适配SnapKit,首先用Xcode8新建一个空项目,利用Cocoapods导入SnapKit. Podfile 打 ...
- 【shiro】报错:Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor
Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor at o ...
- python3 Django框架报错(备忘录)
这篇博客主要总结的学习Django框架中,遇到的报错如何去解决问题: 1.decimal.InvalidOperation: decimal.InvalidOperation: [<class ...
- SSM框架报错分析(一)——There is no getter for property named 'XXX' in 'class java.lang.String'
一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType=&quo ...
- 导入maven框架报错
原因pom文件第一行报错X org.apache.maven.archiver.mavenarchiver.getmanifest怎么解决 解决: 原因就是你的maven的配置文件不是最新的 1.he ...
- 微信小程序 没有找到node_modules目录 ,小程序引入vant框架报错。
如果大家是按照官网的引入方法,是否报错如图 不着急,大家就试试我的方法吧!两步走完美搞定! 第一步: 在小程序顶部点击设置->项目设置,会弹出下面的窗口.大家把使用npm模块勾上对勾. 第二步: ...
随机推荐
- 22.json&pickle&shelve
转载:https://www.cnblogs.com/yuanchenqi/article/5732581.html json 之前我们学习过用eval内置方法可以将一个字符串转成python对象,不 ...
- 超简单!pytorch入门教程(五):训练和测试CNN
我们按照超简单!pytorch入门教程(四):准备图片数据集准备好了图片数据以后,就来训练一下识别这10类图片的cnn神经网络吧. 按照超简单!pytorch入门教程(三):构造一个小型CNN构建好一 ...
- 多vps管理面板
iis7远程桌面连接工具,又叫做iis7远程桌面管理软件,是一款绿色小巧,功能实用的远程桌面管理工具,其界面简洁,操作便捷,能够同时远程操作多台服务器,并且多台服务器间可以自由切换,适用 ...
- Head First设计模式——组合模式
最近比较忙,有段时间没有更新设计模式的进度了.今天继续学习组合设计模式. 组合模式的例子我们继续延续上篇<Head First设计模式——迭代器模式>的菜单例子,首先声明下迭代器和组合模式 ...
- Linux学习笔记(一):什么是挂载?mount的用处在哪?
关于挂载的作用一直不是很清楚,今天在阅读教材时看见了mount这个命令,发现它的用处很隐晦但非常强大.奈何教材说的不明朗,因此在网上整合了一些优秀的解释,看完之后豁然开朗. 1.提一句Windows下 ...
- Windows安装EMQ服务器(mqtt)
先去EMQ官网下载安装包 https://www.emqx.io/downloads#broker 注意:此处一定不能下错成企业版的,不然EMQ会由于缺少企业license无法启动服务 解压到任意路径 ...
- php配置xdebug插件,断点调试
xdebug 下载地址:https://xdebug.org 1.项目目录下新建phpinfo(); 文件: 2.快速查找符合自己的phpxdebug插件: https://xdebug.org/wi ...
- Spring Boot2 系列教程 (十八) | 整合 MongoDB
微信公众号:一个优秀的废人.如有问题,请后台留言,反正我也不会听. 前言 如题,今天介绍下 SpringBoot 是如何整合 MongoDB 的. MongoDB 简介 MongoDB 是由 C++ ...
- NOIP提高组2018试题解析 目录
重磅来袭! 本蒟蒻准备挑战一下NOIP2018提高组的试题啦(怎么办 我猜我连10分都拿不了) 目录: Day1 1.铺设道路 讲解 得分:100 2.货币系统 讲解 3.赛道修建 讲解 ...
- cf - 01串的问题
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...