springboot整合shiro启动报 No SecurityManager accessible to the calling code...错误
今天在springboot整合shiro的时候遇到了一些问题记录一下
1.第一个错误

编辑
报错内容
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);

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

编辑
报错内容
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版本的

完结~~~
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)