微服务-长轮询异常:SecurityManager accessible to the calling code
使用长轮询时,前端出现请求异常,出现如下异常:
[http-nio-18080-exec-5] ERROR o.a.c.c.C.[.[localhost].[/wvp].[dispatcherServlet]:175 - Servlet.service() for servlet [dispatcherServlet] threw exception
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.at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:626)at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)
gateway 提示信息:
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed DURING response
如使用shiro,可对shiro设定支持异步,如下增加bean
@Beanpublic FilterRegistrationBean shiroFilterRegistration() {FilterRegistrationBean registration = new FilterRegistrationBean();registration.setFilter(new DelegatingFilterProxy("shiroFilterFactoryBean"));registration.addInitParameter("targetFilterLifecycle", "true");registration.setEnabled(true);registration.setOrder(Integer.MAX_VALUE - 1);registration.addUrlPatterns("/*");//支持异步registration.setAsyncSupported(true);registration.setDispatcherTypes(DispatcherType.REQUEST,DispatcherType.ASYNC);return registration;}
重新启动后,接口再次调用即可正常返回数据信息。
异常原因:上面错误的原因是我们的shiro filter没有对AsyncContext中的Request没有做拦截,造成SecurityManager为空。
参考:
https://www.jianshu.com/p/aa06c5f2592d
UnavailableSecurityManagerException: No SecurityManager accessible to the calling Spring Shiro异步配置_五菱包工头的博客-CSDN博客
微服务-长轮询异常:SecurityManager accessible to the calling code相关推荐
- 配置拦截器 UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either
转载自:http://www.5180it.com/bbs/admin/1/547.html 今天配置一个拦截器CSRFilter发现以下错误 五月 25, 2021 9:17:52 上午 org.a ...
- 异常处理-No SecurityManager accessible to the calling code
十二月 02, 2016 3:38:35 下午 org.apache.catalina.core.ApplicationDispatcher invoke 严重: Servlet.service() ...
- No SecurityManager accessible to the calling code
No SecurityManager accessible to the calling code 在做一个项目中发现老是出现上图错误,经查询后发现ThreadContext没有绑定SecurityM ...
- 易语言服务端与客户端怎么传送_配置中心是怎么推送的?动手实现一个 Long Polling 长轮询...
介绍 众所周知,数据交互有两种模式:Push(推模式).Pull(拉模式). 推模式指的是客户端与服务端建立好网络长连接,服务方有相关数据,直接通过长连接通道推送到客户端.其优点是及时,一旦有数据变更 ...
- 用了这么久配置中心,还不知道长轮询是什么?
前言 传统的静态配置方式想要修改某个配置时,必须重新启动一次应用,如果是数据库连接串的变更,那可能还容易接受一些,但如果变更的是一些运行时实时感知的配置,如某个功能项的开关,重启应用就显得有点大动干戈 ...
- RocketMQ 的长轮询如何实现 ?
最近仍然畅游在RocketMQ的源码中,这几天刚好翻到了消费者的源码,发现RocketMQ的对于push消费方式的实现简直太聪明了,所以趁着我脑子里还有点印象的时候,赶紧来写一篇文章,来掰扯一下,防止 ...
- spring 实现异步非阻塞长轮询
一. 前言 今天接到一个扫码登录的需求.想一想很简单,服务端提供一个获取二维码接口,在提供一个查询扫码状态的接口,客户端不停轮询"查询扫码状态接口"判断用户是否已扫码登录,并很快实 ...
- HTTP - 长连接 短连接 长轮询 短轮询 心跳机制
错觉与突然的察觉 大多数人都知道HTTP1.0不支持长连接,知道HTTP1.1支持长连接. 这是业界的一个常识. 然而这样的描述导致了一些不做网络底层开发的开发者都下意识的认为HTTP1.1是一个可以 ...
- 浅谈长轮询及其封装实现
1. 简介 长轮询是与服务器保持即时通信的最简单的方式,它不使用任何特定的协议,例如 WebSocket ,所以也不依赖于浏览器版本等外部条件的兼容性,它很容易实现,也无需引入其他依赖,在很多场景下可 ...
最新文章
- 博三才发文章,打破学校零记录,华科博士入职华为年薪201万
- ASP.NET BookMark
- 如何检查Go中是否存在文件?
- c++【深度剖析shared_ptr】
- ubuntu apache配置负载均衡篇(二)
- 大学生计算机二级大集报名最好,在校大学生如何报名计算机二级?
- 移动App后台Java开发银联支付后台接口
- 种草电商系统种草电商系统开发解决方案
- html设置图片为黑白,CSS 将彩色图片转换成黑白图片
- STM8S003F3和N76E003功能引脚对比
- [爬虫笔记01] Ajax爬取今日头条文章
- 比较文档相似度c语言,Doc2Vec,Word2Vec文本相似度 初体验。
- oppo计算机怎么添加到桌面,OPPO怎么把快捷方式添加到桌面 OPPO把快捷方式添加到桌面方法...
- 数据库基本概念、DBMS、DBS
- SAP中输出采购订单GR/IR标识清单
- image-webpack-loader (in ./src/assets/404_images/404_cloud.png)
- 《Django By Example》读书笔记 03
- 2020开年最火css效果实现
- 明日之后找回原来的服务器,明日之后怎么找回原来的账号
- 告别纸币!人民币迎来大升级,央行试点区块链数字货币!