Closed
Description
简要描述
企业微信第三方应用开发过程中,需要监听微信的新增部门事件,在将解析好的xml数据映射到WxCpTpXmlMessage时,报了下面日志中的错误。
模块版本情况
- WxJava 模块名: CpTp
- WxJava 版本号: weixin-java-cp-4.0.0
详细描述
企业微信第三方应用开发过程中,需要监听微信的新增部门事件,在将解析好的xml数据映射到WxCpTpXmlMessage时,报了下面日志中的错误。经调试发现,应该是order字段声明为了Integer类型,但是字段上面的注解@XStreamConverter(value = XStreamCDataConverter.class)
仍然是解析string类型的转换类。
日志
以下是解析完xml之后,映射给WxCpTpXmlMessage类时报的错误堆栈
com.thoughtworks.xstream.converters.ConversionException: Explicit selected converter cannot handle type
---- Debugging information ----
message : Explicit selected converter cannot handle type
item-type : java.lang.Integer
converter-type : com.thoughtworks.xstream.converters.SingleValueConverterWrapper
class : me.chanjar.weixin.cp.bean.message.WxCpTpXmlMessage
required-type : me.chanjar.weixin.cp.bean.message.WxCpTpXmlMessage
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number : 1
version : not available
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:499)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)