以前,我的应用程序在 Java 5 上运行,我使用 StaxUtil 读取 XML,一切正常。
我正在尝试将我的应用程序升级到 Java 6,但它一直抛出这个异常
Failed to update internal Cache.
com.sgx.clear.mbus.mbc.exception.ClientException: Error in parsing XML.:java.lang.Exception: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[165,16]
Message: An invalid XML character (Unicode: 0x2) was found in the element content of the document. [ErrorCode: 11070108]
at com.sgx.clear.mbus.common.util.SecurInterfaceUtil.error(Unknown Source)
at com.sgx.clear.mbus.common.util.ParseUtil.parseToJniObject(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.AbstractDirectServices.parseSecurReplyCache(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.query.AbstractDirectQueryServices.getWrapperTArray(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.query.MarketBackOffice.getMarketBackOfficeCache(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.CacheManager._processMarketBackOfficeUpdate(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.CacheManager.updateMarketBackOffice(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.CacheManager.updateAll(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.AbstractDirectAdminServices.processAdminRequest(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.AbstractDirectAdminServices.processRequest(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.Admin.login(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.admin.DirectAdminServices.login(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.services.DirectServiceManager.login(Unknown Source)
at com.sgx.dsp.secur.adaptor.SecurInterfaceAdaptor.login(SecurInterfaceAdaptor.java:1223)
at com.sgx.dsp.server.task.SessionMaintainer.run(SessionMaintainer.java:210)
at com.sgx.dsp.server.core.AbstractDSPTask$1.run(AbstractDSPTask.java:1885)
Caused by: java.lang.Exception: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[165,16]
Message: An invalid XML character (Unicode: 0x2) was found in the element content of the document.
at com.sgx.clear.mbus.mbc.directclient.beans.AnswerMarketItemT$Factory.parse(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.beans.Array100Ofomex__answer_market_item_t$Factory.parse(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.beans.AnswerMarketT$Factory.parse(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.beans.ExtensionMapper.getTypeObject(Unknown Source)
at com.sgx.clear.mbus.mbc.directclient.beans.StructWrapperT$Factory.parse(Unknown Source)
... 15 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[165,16]
Message: An invalid XML character (Unicode: 0x2) was found in the element content of the document.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:594)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getElementText(XMLStreamReaderImpl.java:837)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getElementText(XMLStreamReaderWrapper.java:100)
... 20 more
这是我使用的代码
XMLStreamReader qReader = StAXUtils
.createXMLStreamReader( new StringReader( message ) );
我猜这是因为以前 XMLStreamReader 来自 stax-api-1.0.1.jar 但在 Java 6 中,它来自 rt.jar。
有人知道如何解决吗?