springboot整合shiro启动报 No SecurityManager accessible to the calling code...错误

今天在springboot整合shiro的时候遇到了一些问题记录一下

1.第一个错误
wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==编辑

报错内容

Cause: org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.
 

查阅资料才知道看报错是 ThreadContext未绑定SecurityManager

我看自己代码也没写

给他加上

ThreadContext.bind(defaultWebSecurityManager);

加上之后运行又出现第二个错误

第二个错误


wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==编辑
报错内容

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed: java.lang.NoClassDefFoundError: javax/servlet/ServletRequest] with root cause

后面也是查了资料才确定是少了javax.servlet依赖
pom.xml文件导入以下依赖
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
    <scope>provided</scope>
</dependency>

然后重新运行,方法正常调用

运行正常,密码是错的没错。页面也正常

我jdk是17版本的

完结~~~

  • 15
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值