以前,我的应用程序是在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。
有人知道如何解决它吗?