lyq13765321849
熔岩上的灌木
2017-07-31 05:36

dubbo rpc如何指定fastjson方式序列化参数对象

5
  • json
  • dubbo rpc

我在使用dubbo RPC请求时,参数中包含泛型的List集合对象,使用post方式提交时,系统后台报错如下
user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
, dubbo version: 2.8.4, current host: 127.0.0.1
2017-07-31 11:29:10,310 INFO (LoggingFilter.java:73) - [DUBBO] The contents of request body is:
{"sign":"991ca99cb509b927b83994b877666f53","appId":"001","requestTime":"1487687421","service":"credit","channelCode":"200800120036",
"loanList":"[{\"approvalOpinions\":\"|【外部意见】2|【意见】d|【外部意见】d|【意见】d|【外部意见】d|【意见】d|【外部意见】d\",\"brandMode\":\"奥迪(进口) - A6L 2.5 30FSI 技术型\",\"contactId\":\"1516000038\",\"customerId\":\"济南分公司\",\"idNumber\":\"564564\",\"idNumberType\":\"Ent02\",\"isGps\":1,\"loanAmount\":162557.4,\"loanAmountRemain\":162557.4,\"loanAmountZrb\":162557.4,\"loanAmountZrb2\":162557.4,\"loanEndDate\":\"2017/04/26\",\"loanEndDateZrb\":\"2018/03/28\",\"loanLife\":12,\"loanLifeRemain\":8,\"loanMode\":\"租赁模式\",\"loanPrfoitZrb\":0.01,\"loanProfit\":0.00416667,\"loanStartDate\":\"2016/04/26\",\"loanStartDateZrb\":\"2017/07/28\",\"payStyle\":\"等额本息\",\"paymentAmountMonthly\":29358.06,\"productType\":\"不要修改测试数据!!\",\"score\":0,\"totalOverdueOrders\":0,\"vehicleAttribute\":\"新车\",\"vehicleDownPaymentPrice\":17854.6,\"vehicleEvaluationPrice\":178546,\"vehiclePrice\":178546},{\"approvalOpinions\":\"|【外部意见】2|【意见】d|【外部意见】d|【意见】d|【外部意见】d|【意见】d|【外部意见】d\",\"brandMode\":\"奥迪(进口) - A3 Sportback 1.8 豪华型\",\"contactId\":\"1516000039\",\"customerId\":\"云南分公司\",\"idNumber\":\"564564\",\"idNumberType\":\"Ent02\",\"isGps\":1,\"loanAmount\":172423.2,\"loanAmountRemain\":172423.2,\"loanAmountZrb\":172423.2,\"loanAmountZrb2\":172423.2,\"loanEndDate\":\"2017/04/26\",\"loanEndDateZrb\":\"2018/03/28\",\"loanLife\":12,\"loanLifeRemain\":8,\"loanMode\":\"租赁模式\",\"loanPrfoitZrb\":0.01,\"loanProfit\":0.00416667,\"loanStartDate\":\"2016/04/26\",\"loanStartDateZrb\":\"2017/07/28\",\"payStyle\":\"等额本息\",\"paymentAmountMonthly\":31139.86,\"productType\":\"不要修改测试数据!!\",\"score\":0,\"totalOverdueOrders\":0,\"vehicleAttribute\":\"新车\",\"vehicleDownPaymentPrice\":18945.8,\"vehicleEvaluationPrice\":189458,\"vehiclePrice\":189458}]",
"pageSize":"200","batchNum":"ZRB20170221_20170221223010356","totalCnt":"535","pageNum":"3","accessToken":"Zrb0012"}
, dubbo version: 2.8.4, current host: 127.0.0.1
2017-07-31 11:29:10,311 ERROR (OtherExceptionMapper.java:25) - 系统处理异常
org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token
at Source: java.io.ByteArrayInputStream@3a131c45; line: 1, column: 132
at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) ~[jackson-mapper-asl-1.9.12.jar:1.9.12]
at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219) ~[jackson-mapper-asl-1.9.12.jar:1.9.12]
at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException

看上述问题是 org.codehaus.jackson 在转换参数时报错了 ,使用alibaba 的fastjson是可以转换的,但是在dubbo中如何指定fastjson序列化方式 。请求参数为上述的request body中,请问是否有大神帮忙解决一下,谢谢

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答