博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
com.thoughtworks.xstream.converters.ConversionException
阅读量:5356 次
发布时间:2019-06-15

本文共 4492 字,大约阅读时间需要 14 分钟。

使用webService调用接口,返回的是xml格式,运用xstream解析的时候,出现了如下的错误:

1 Exception in thread "Timer-1" com.thoughtworks.xstream.converters.ConversionException: For input string: "VS" : For input string: "VS" 2 ---- Debugging information ---- 3 message             : For input string: "VS" 4 cause-exception     : java.lang.NumberFormatException 5 cause-message       : For input string: "VS" 6 class               : java.lang.Integer 7 required-type       : java.lang.Integer 8 converter-type      : com.thoughtworks.xstream.converters.SingleValueConverterWrapper 9 wrapped-converter   : com.thoughtworks.xstream.converters.basic.IntConverter10 path                : /interface/items/roomstate11 class[1]            : catic.hotel.server.webservice.Items12 converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter13 class[2]            : catic.hotel.server.webservice.Interface14 version             : null15 -------------------------------16     at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)17     at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)18     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)19     at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:355)20     at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:306)21     at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234)22     at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)23     at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)24     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)25     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)26     at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:322)27     at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234)28     at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)29     at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)30     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)31     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)32     at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)33     at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)34     at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1058)35     at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1042)36     at com.thoughtworks.xstream.XStream.fromXML(XStream.java:913)37     at com.thoughtworks.xstream.XStream.fromXML(XStream.java:904)38     at catic.library.util.XmlBeanConvertUtil.xml2Bean(XmlBeanConvertUtil.java:27)39     at catic.library.util.XMLUtil.roomStatusXmlToList2(XMLUtil.java:86)40     at catic.hotel.server.server.ReadDataByPMSOurDB$ReadPMSUptOurDB.run(ReadDataByPMSOurDB.java:104)41     at java.util.TimerThread.mainLoop(Unknown Source)42     at java.util.TimerThread.run(Unknown Source)43 Caused by: java.lang.NumberFormatException: For input string: "VS"44     at java.lang.NumberFormatException.forInputString(Unknown Source)45     at java.lang.Long.parseLong(Unknown Source)46     at java.lang.Long.valueOf(Unknown Source)47     at java.lang.Long.decode(Unknown Source)48     at com.thoughtworks.xstream.converters.basic.IntConverter.fromString(IntConverter.java:27)49     at com.thoughtworks.xstream.converters.SingleValueConverterWrapper.fromString(SingleValueConverterWrapper.java:41)50     at com.thoughtworks.xstream.converters.SingleValueConverterWrapper.unmarshal(SingleValueConverterWrapper.java:49)51     at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)52     ... 26 more

由43行可以看出,是类型转换异常,因为返回的类型既有String,又有Integer,而我只用了Integer,忽略了String,所以报错。

刚开始还以为是使用xstream报的错,由于是第一次使用这个东东……不过,xstream这个东东真的很好用。

转载于:https://www.cnblogs.com/xbq8080/p/6366207.html

你可能感兴趣的文章
jmeter(五)创建web测试计划
查看>>
python基本数据类型
查看>>
1305: [CQOI2009]dance跳舞 - BZOJ
查看>>
将html代码中的大写标签转换成小写标签
查看>>
jmeter多线程组间的参数传递
查看>>
零散笔记
查看>>
MaiN
查看>>
[Python学习] 简单网络爬虫抓取博客文章及思想介绍
查看>>
触发器课程SQL Server 知识梳理九 触发器的使用
查看>>
信息浏览器从Android的浏览器中传递cookie数据到App中信息浏览器
查看>>
客户端连接linux虚拟机集群报错
查看>>
linux下部署一个JavaEE项目的简单步骤
查看>>
hash储存机制
查看>>
[Android学习系列16]Android把php输出的json加载到listview
查看>>
20145205 《信息安全系统设计基础》第14周学习总结
查看>>
6)添加一个窗口的图标
查看>>
POJ - 1422 Air Raid 二分图最大匹配
查看>>
Road Map
查看>>
正则替换中的一个Bug
查看>>
HI3531uboot开机画面 分类: arm-linux-Ubunt...
查看>>