fastjson 当使用Spring的@RequestBody报错

d5vmydt9  于 2021-11-27  发布在  Java
关注(0)|答案(19)|浏览(558)

{
"exception": {
"@type": "com.alibaba.fastjson.JSONException",
"localizedMessage": "syntax error, pos 6, json : userId=1&occUserId=1&stationId=1&stationNum=2G-W30&dateTime=2016-08-24&flag=1&type=1&source=1&lang=zh_CN",
"message": "syntax error, pos 6, json : userId=1&occUserId=1&stationId=1&stationNum=2G-W30&dateTime=2016-08-24&flag=1&type=1&source=1&lang=zh_CN",
"stackTrace": [
{
"className": "com.alibaba.fastjson.parser.DefaultJSONParser",
"fileName": "DefaultJSONParser.java",
"lineNumber": 1361,
"methodName": "parse",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.parser.DefaultJSONParser",
"fileName": "DefaultJSONParser.java",
"lineNumber": 1268,
"methodName": "parse",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.serializer.StringCodec",
"fileName": "StringCodec.java",
"lineNumber": 105,
"methodName": "deserialze",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.serializer.StringCodec",
"fileName": "StringCodec.java",
"lineNumber": 87,
"methodName": "deserialze",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.parser.DefaultJSONParser",
"fileName": "DefaultJSONParser.java",
"lineNumber": 614,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.JSON",
"fileName": "JSON.java",
"lineNumber": 339,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.JSON",
"fileName": "JSON.java",
"lineNumber": 307,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.JSON",
"fileName": "JSON.java",
"lineNumber": 270,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.JSON",
"fileName": "JSON.java",
"lineNumber": 370,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.JSON",
"fileName": "JSON.java",
"lineNumber": 452,
"methodName": "parseObject",
"nativeMethod": false
},
{
"className": "com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4",
"fileName": "FastJsonHttpMessageConverter4.java",
"lineNumber": 71,
"methodName": "read",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver",
"fileName": "AbstractMessageConverterMethodArgumentResolver.java",
"lineNumber": 197,
"methodName": "readWithMessageConverters",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor",
"fileName": "RequestResponseBodyMethodProcessor.java",
"lineNumber": 149,
"methodName": "readWithMessageConverters",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor",
"fileName": "RequestResponseBodyMethodProcessor.java",
"lineNumber": 127,
"methodName": "resolveArgument",
"nativeMethod": false
},
{
"className": "org.springframework.web.method.support.HandlerMethodArgumentResolverComposite",
"fileName": "HandlerMethodArgumentResolverComposite.java",
"lineNumber": 121,
"methodName": "resolveArgument",
"nativeMethod": false
},
{
"className": "org.springframework.web.method.support.InvocableHandlerMethod",
"fileName": "InvocableHandlerMethod.java",
"lineNumber": 161,
"methodName": "getMethodArgumentValues",
"nativeMethod": false
},
{
"className": "org.springframework.web.method.support.InvocableHandlerMethod",
"fileName": "InvocableHandlerMethod.java",
"lineNumber": 128,
"methodName": "invokeForRequest",
"nativeMethod": false
},
{
"className": "org.springframework.web.method.annotation.ModelFactory",
"fileName": "ModelFactory.java",
"lineNumber": 139,
"methodName": "invokeModelAttributeMethods",
"nativeMethod": false
},
{
"className": "org.springframework.web.method.annotation.ModelFactory",
"fileName": "ModelFactory.java",
"lineNumber": 109,
"methodName": "initModel",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter",
"fileName": "RequestMappingHandlerAdapter.java",
"lineNumber": 805,
"methodName": "invokeHandlerMethod",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter",
"fileName": "RequestMappingHandlerAdapter.java",
"lineNumber": 738,
"methodName": "handleInternal",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter",
"fileName": "AbstractHandlerMethodAdapter.java",
"lineNumber": 85,
"methodName": "handle",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.DispatcherServlet",
"fileName": "DispatcherServlet.java",
"lineNumber": 963,
"methodName": "doDispatch",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.DispatcherServlet",
"fileName": "DispatcherServlet.java",
"lineNumber": 897,
"methodName": "doService",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.FrameworkServlet",
"fileName": "FrameworkServlet.java",
"lineNumber": 970,
"methodName": "processRequest",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.FrameworkServlet",
"fileName": "FrameworkServlet.java",
"lineNumber": 872,
"methodName": "doPost",
"nativeMethod": false
},
{
"className": "javax.servlet.http.HttpServlet",
"fileName": "HttpServlet.java",
"lineNumber": 646,
"methodName": "service",
"nativeMethod": false
},
{
"className": "org.springframework.web.servlet.FrameworkServlet",
"fileName": "FrameworkServlet.java",
"lineNumber": 846,
"methodName": "service",
"nativeMethod": false
},
{
"className": "javax.servlet.http.HttpServlet",
"fileName": "HttpServlet.java",
"lineNumber": 727,
"methodName": "service",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 303,
"methodName": "internalDoFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 208,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "com.wafersystems.filter.SessionTimeOutFilter",
"fileName": "SessionTimeOutFilter.java",
"lineNumber": 58,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 241,
"methodName": "internalDoFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 208,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "com.alibaba.druid.support.http.WebStatFilter",
"fileName": "WebStatFilter.java",
"lineNumber": 123,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 241,
"methodName": "internalDoFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 208,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.springframework.orm.hibernate5.support.OpenSessionInViewFilter",
"fileName": "OpenSessionInViewFilter.java",
"lineNumber": 151,
"methodName": "doFilterInternal",
"nativeMethod": false
},
{
"className": "org.springframework.web.filter.OncePerRequestFilter",
"fileName": "OncePerRequestFilter.java",
"lineNumber": 107,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 241,
"methodName": "internalDoFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 208,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.springframework.web.filter.CharacterEncodingFilter",
"fileName": "CharacterEncodingFilter.java",
"lineNumber": 197,
"methodName": "doFilterInternal",
"nativeMethod": false
},
{
"className": "org.springframework.web.filter.OncePerRequestFilter",
"fileName": "OncePerRequestFilter.java",
"lineNumber": 107,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 241,
"methodName": "internalDoFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.ApplicationFilterChain",
"fileName": "ApplicationFilterChain.java",
"lineNumber": 208,
"methodName": "doFilter",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.StandardWrapperValve",
"fileName": "StandardWrapperValve.java",
"lineNumber": 220,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.StandardContextValve",
"fileName": "StandardContextValve.java",
"lineNumber": 122,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.authenticator.AuthenticatorBase",
"fileName": "AuthenticatorBase.java",
"lineNumber": 503,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.StandardHostValve",
"fileName": "StandardHostValve.java",
"lineNumber": 170,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.valves.ErrorReportValve",
"fileName": "ErrorReportValve.java",
"lineNumber": 103,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.valves.AccessLogValve",
"fileName": "AccessLogValve.java",
"lineNumber": 950,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.core.StandardEngineValve",
"fileName": "StandardEngineValve.java",
"lineNumber": 116,
"methodName": "invoke",
"nativeMethod": false
},
{
"className": "org.apache.catalina.connector.CoyoteAdapter",
"fileName": "CoyoteAdapter.java",
"lineNumber": 421,
"methodName": "service",
"nativeMethod": false
},
{
"className": "org.apache.coyote.http11.AbstractHttp11Processor",
"fileName": "AbstractHttp11Processor.java",
"lineNumber": 1070,
"methodName": "process",
"nativeMethod": false
},
{
"className": "org.apache.coyote.AbstractProtocol$AbstractConnectionHandler",
"fileName": "AbstractProtocol.java",
"lineNumber": 611,
"methodName": "process",
"nativeMethod": false
},
{
"className": "org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor",
"fileName": "JIoEndpoint.java",
"lineNumber": 316,
"methodName": "run",
"nativeMethod": false
},
{
"className": "java.util.concurrent.ThreadPoolExecutor$Worker",
"fileName": "ThreadPoolExecutor.java",
"lineNumber": 895,
"methodName": "runTask",
"nativeMethod": false
},
{
"className": "java.util.concurrent.ThreadPoolExecutor$Worker",
"fileName": "ThreadPoolExecutor.java",
"lineNumber": 918,
"methodName": "run",
"nativeMethod": false
},
{
"className": "org.apache.tomcat.util.threads.TaskThread$WrappingRunnable",
"fileName": "TaskThread.java",
"lineNumber": 61,
"methodName": "run",
"nativeMethod": false
},
{
"className": "java.lang.Thread",
"fileName": "Thread.java",
"lineNumber": 662,
"methodName": "run",
"nativeMethod": false
}
]
}
}

jgwigjjp

jgwigjjp16#

@805728578 按照你的方式写了个testcase 并没有出现异常. see FastJsonControllerTest.test6()
FastJsonHttpMessageConverterTest.test6()

ego6inou

ego6inou18#

@805728578 请问报什么错 请提供测试用例

3xiyfsfu

3xiyfsfu19#

@VictorZeng 帮忙看看

相关问题