WSO2AM 1.10.0 - JSONStream END_OBJECT

时间:2016-07-01 03:17:51

标签: wso2 wso2-am

我在wso2am 1.9.1中使用org.apache.synapse.commons.json.JsonStreamBuilder和org.apache.synapse.commons.json.JsonStreamFormatter,我没有遇到JSON问题格式错误,但是在wso2am 1.10.0中,我收到了这个错误:

[2016-06-30 23:50:22,489] ERROR - AnonymousListMediator javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,10]
Message: Unexpected symbol: END_OBJECT
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,10]
Message: Unexpected symbol: END_OBJECT
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedElementImpl.java:880)
    at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:122)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:343)
    at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
    at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:58)
    at org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:414)
    at org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:421)
    at org.apache.synapse.commons.json.JsonUtil.removeJsonPayload(JsonUtil.java:624)
    at org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(PayloadFactoryMediator.java:158)
    at org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(PayloadFactoryMediator.java:100)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:30)
    at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:203)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155)
    at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86)
    at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
    at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:89)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:363)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

是的,我的应用程序中存在JSON格式错误,但我现在无法修复此问题,有一种方法可以获得与wso2am 1.9.1相同的行为吗?这是一个错误或api经理不必传递JSON格式错误?

已编辑:如果我使用org.apache.axis2.json.JSONStreamFormatter和org.apache.axis2.json.JSONStreamBuilder,我没有遇到问题,但我看到的是导致原型APIS失败,改变此配置后GET方法不起作用。

谢谢

2 个答案:

答案 0 :(得分:0)

一种解决方法是将消息构建为纯文本内容。您可以使用以下构建器。

<messageBuilder contentType="text/plain"
                        class="org.apache.axis2.format.PlainTextBuilder"/>

答案 1 :(得分:0)

您可能在Content-Lenght标头中输入了错误的值。删除标题Content-Length。