FastChar官网
FastChar官网 FastChar
捐助公告
  • 欧克克 863***453@qq.com ¥59.0
  • *💋 180*****471 ¥39.0
  • 懒者 433***782@qq.com ¥39.0
  • 默默猴 874***370@qq.com ¥199.0
  • 认真的猿 116****803@qq.com ¥39.0
  • 爱心 126****357@qq.com ¥39.0
  • 能量 257***146@163.com ¥19.0
  • 水染的天色 113****338@qq.com ¥39.0
  • 微笑的死神 156****158@qq.com ¥39.0
  • 笑话 bai***121@163.com ¥39.0
 json字符串转FastEntity类报错
  欺代码    提问于:2020-01-09 13:44    阅读次数:1109
  

使用FastJson工具将Json字符串转成FastEntity类报错

com.alibaba.fastjson.parser.deserializer.MapDeserializer.createMap(MapDeserializer.java:383)
at com.alibaba.fastjson.parser.deserializer.MapDeserializer.createMap(MapDeserializer.java:320)
at com.alibaba.fastjson.parser.deserializer.MapDeserializer.deserialze(MapDeserializer.java:37)
at com.alibaba.fastjson.parser.deserializer.FastjsonASMDeserializer_1_APIHandler.deserialze(Unknown Source)
at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:284)
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:378)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:282)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:555)
at com.fastchar.extend.fastjson.FastJsonProvider.fromJson(FastJsonProvider.java:25)
at com.fast.pay.entity.FcDataOrderEntity.getApiHandler(FcDataOrderEntity.java:85)
at com.fast.pay.entity.FcOrderTradeEntity.toSimpleBean(FcOrderTradeEntity.java:160)
at com.fast.pay.entity.FcOrderTradeEntity.toPayBean(FcOrderTradeEntity.java:173)
at com.fast.pay.api.APICreditCardTrade.processRequest(APICreditCardTrade.java:164)
at com.fast.pay.api.core.APIHelper.routeAPI(APIHelper.java:171)
at com.fast.pay.api.core.APIHelper.doRequest(APIHelper.java:150)
at com.fast.pay.action.OpenAction.execute(OpenAction.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.fastchar.core.FastRoute.invoke(FastRoute.java:212)
at com.fastchar.core.FastAction.invoke(FastAction.java:93)
at com.fastchar.extjs.interceptor.FastExtGlobalInterceptor.onInterceptor(FastExtGlobalInterceptor.java:34)
at com.fastchar.core.FastRoute.invoke(FastRoute.java:200)
at com.fastchar.core.FastDispatcher.invoke(FastDispatcher.java:551)
at com.fastchar.core.FastFilter.doFilter(FastFilter.java:54)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by:java.lang.IllegalAccessException: Class com.alibaba.fastjson.parser.deserializer.MapDeserializer can not access a member of class com.web.entity.FcAccountEntity with modifiers "protected"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.Class.newInstance(Class.java:436)
at com.alibaba.fastjson.parser.deserializer.MapDeserializer.createMap(MapDeserializer.java:381)
at com.alibaba.fastjson.parser.deserializer.MapDeserializer.createMap(MapDeserializer.java:320)
at com.alibaba.fastjson.parser.deserializer.MapDeserializer.deserialze(MapDeserializer.java:37)
at com.alibaba.fastjson.parser.deserializer.FastjsonASMDeserializer_1_APIHandler.deserialze(Unknown Source)
at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:284)
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:378)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:282)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:555)
at com.fastchar.extend.fastjson.FastJsonProvider.fromJson(FastJsonProvider.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.fastchar.core.FastRoute.invoke(FastRoute.java:212)
at com.fastchar.core.FastAction.invoke(FastAction.java:93)
at com.fastchar.extjs.interceptor.FastExtGlobalInterceptor.onInterceptor(FastExtGlobalInterceptor.java:34)
at com.fastchar.core.FastRoute.invoke(FastRoute.java:200)
at com.fastchar.core.FastDispatcher.invoke(FastDispatcher.java:551)
at com.fastchar.core.FastFilter.doFilter(FastFilter.java:54)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
FastChar官网
FastChar 2020-01-09 13:48
   

这种情况,应该是你使用了FastChar-Auto自动生成的实体类,由于FastChar-Auto自动生成的类将构造函数生成为protected,所以json自动转换无法实例化该类的对象,所以只要将构造函数删除或改为public即可!

FastChar官网
欺代码  [提问者] 2020-01-09 13:50
   

回复:FastChar

知道了,谢谢!