错误信息:

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. [转]EXCEL截取字符串中某几位的函数——LeftMIDRight及Find函数的使用

    原文地址:http://blog.sina.com.cn/s/blog_3f136a180102ymq5.html EXCEL截取字符串中某几位的函数 ——Left MID Right及Find函数的 ...

  2. MacOS 安装配置 Laravel

    简单介绍: Laravel是一个用PHP编写的免费开源Web框架.它是由Taylor Otwell创作的,遵循MVC开发方法. 截至2015年3月,Laravel被认为是最流行的基于PHP的框架之一. ...

  3. 泡泡一分钟:Semi-Dense Visual-Inertial Odometry and Mapping for Quadrotors with SWAP Constraints

    张宁 Semi-Dense Visual-Inertial Odometry and Mapping for Quadrotors with SWAP Constraints 具有SWAP约束的四旋翼 ...

  4. layui select渲染获取选中的option

    关键代码如下: form.on('select(groupCode)', function(data){ console.log($(data.elem).find("option:sele ...

  5. Connection reset by peer引发的思考

    http://www.mamicode.com/info-detail-506381.html

  6. web端自动化——Selenium Server环境配置

    Selenium Server环境配置 下面下载.配置并运行Selenium Server. ①    下载 Selenium Server. 下载地址为:https://pypi.python.or ...

  7. QT学习之usb摄像头采集(Opencv+QT)[cvCapture,IplImage,QImage]

    参考自:http://blog.chinaunix.net/uid-23381466-id-3826748.html 将Opencv中的cvCaptureFromCAM不断获得摄像头采集到的图像数据, ...

  8. 【GStreamer开发】GStreamer基础教程09——收集媒体信息

    目标 有时你需要快速的了解一个文件(或URI)包含的媒体格式或者看看是否支持这种格式.当然你可以创建一个pipeline,设置运行,观察总线上的消息,但GStreamer提供了一个工具可以帮你做这些. ...

  9. BP神经网络设计常用的基本方法和实用技术

    尽管神经网络的研究和应用已经取得巨大成功,但在网络的开发设计方面至今仍没有一套完善的理论做指导,应用中采取的主要设计方法是,在充分了解待解决问题的基础上将经验与试探相结合,通过多次改进性试验,最终选出 ...

  10. mac tar 解压

    1.下载mac上对应rar版本 http://www.rarlab.com/download.htm2.利用tar名解压下载的rarosx-5.4.0.tar.gz,版本可能会更新tar xzvf a ...