错误信息:

nested exception is java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)] with root cause:
错误原因:

joinPoint.getArgs()返回的数组中携带有Request(HttpServletRequest)或者Response(HttpServletResponse)对象,导致序列化异常。

解决方案:

//aop中获取请求参数

Object[] args = joinPoint.getArgs();
Stream<?> stream = ArrayUtils.isEmpty(args) ? Stream.empty() : Arrays.asList(args);
List<Object> logArgs = stream.filter(arg -> (!(arg instanceof HttpServletRequest) && !(arg instanceof HttpServletResponse))).collect(Collectors.toList());
//过滤后序列化无异常
String string = JSON.toJSONString(logArgs);

Aop 打印参数日志时,出现参数序列化异常。It is illegal to call this method if the current request is not in asynchron的更多相关文章

  1. AOP拦截日志类,抛异常:java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode

    AOP的日志拦截类中,抛出异常: java.lang.IllegalStateException: It is illegal to call this method if the current r ...

  2. AOP拦截日志报错llegalStateException: It is illegal to call this method if the current request is not in asynchronous mode

    原文链接:https://my.oschina.net/mengzhang6/blog/2395893 关于一次AOP拦截入参记录日志报错的梳理总结 将服务发布到tomcat中后,观察服务的运行状态以 ...

  3. SpringBoot中使用AOP打印接口日志的方法(转载)

    前言 AOP 是 Aspect Oriented Program (面向切面)的编程的缩写.他是和面向对象编程相对的一个概念.在面向对象的编程中,我们倾向于采用封装.继承.多态等概念,将一个个的功能在 ...

  4. 打印 Logger 日志时,需不需要再封装一下工具类?

    在开发过程中,打印日志是必不可少的,因为日志关乎于应用的问题排查.应用监控等.现在打印日志一般都是使用 slf4j,因为使用日志门面,有助于打印方式统一,即使后面更换日志框架,也非常方便.在 < ...

  5. AOP打印请求日志,打印返回值

    @Aspect // 申明是个spring管理的bean @Component @Slf4j public class LogAspectServiceApi { private JSONObject ...

  6. Log4j2打印一行日志时返回本行日志的字符串

    import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.impl.Log4jLogEvent; impo ...

  7. Springboot AOP写操作日志 GET POST

    pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  8. IDEA打印gc日志,设置JVM参数方法

    打印gc日志 1.对指定运行程序输出GC日志: 点击edit configurations... 在vm options处加入-XX:+PrintGCDetails 测试:代码调用system.gc后 ...

  9. Linux 打印可变参数日志

    实现了传输进去的字符串所在的文档,函数和行数显示功能. 实现了将传入的可变参数打印到日志功能. #include<stdio.h> #include<stdarg.h> #in ...

随机推荐

  1. MQTT教學(二):安裝MQTT伺服器Mosquitto,Windows系統篇

    http://swf.com.tw/?p=1005 「認識MQTT」文章提到,MQTT的訊息全都透過稱為代理人(broker)的伺服器交流.本文將說明頗受歡迎的開放原始碼MQTT伺服器Mosquitt ...

  2. The Art of Picking Intel Registers Intel寄存器的艺术

    https://www.swansontec.com/sregisters.html I wrote this article for an online magazine called Scene ...

  3. ubuntu18.04安装docker和开通对外2375端口(方便portainer管理)

    date: 2019-08-03   21:39:37 author: headsen chen apt-get install apt-transport-https ca-certificates ...

  4. Information:java: Multiple encodings set for module chunk platf "GBK" will be used by compile

    转自:https://blog.csdn.net/xiaobing_122613/article/details/81866445 Intellij IDEA 在引入代码后,出现编译错误. Infor ...

  5. ES6深入浅出-13 Proxy 与 Reflect-3.Vue 3 将用 Proxy 改写

    如果说想打印出来年龄,但是有没有年龄的这个key值 把创建年龄写在一个按钮上面 通过一个事件来做. 点击创建年龄的按钮,给obj.age设置为18,但是页面的双向绑定并没有显示出来. 因为不响应式,为 ...

  6. 转 移动云基于MySQL Galera的PXC运维实战

    ##sample 1 : mysql 监控 1.phpadmin  比较简单,适合上手 2.mysql_web python 写的, https://github.com/ycg/mysql_web/ ...

  7. 【432】COMP9024,Exercise9

    eulerianCycle.c What determines whether a graph is Eulerian or not? Write a C program that reads a g ...

  8. python flask框架学习(一)——准备工作和环境配置与安装

    Flask装备: 学习自:知了课堂Python Flask框架——全栈开发 1.Python版本:3.6 2.Pycharm软件: 3.安装虚拟环境: (1)安装virtualenv: pip ins ...

  9. Redis项目实战

    1.显示最新的项目列表 下面这个语句常用来显示最新项目,随着数据多了,查询毫无疑问会越来越慢. SELECT * FROM foo WHERE ... ORDER BY time DESC LIMIT ...

  10. 【DeepCTR】

    DeepFM: https://www.jianshu.com/p/6f1c2643d31b CCPM,FGCNN: https://cloud.tencent.com/developer/artic ...