wso2数据映射器SequenceMediator运行时错误

时间:2016-07-21 01:38:34

标签: wso2 wso2esb wso2carbon

我正在尝试使用数据映射器来映射来自两(2)个不同api的响应。所以我所做的是使用克隆介体和聚合介体将这两个api合并在一起,然后使用数据映射器对其进行映射,但是当我进入数据映射器部分时,我总是会收到错误。如果我删除了数据映射器中介部件,它就可以工作。

这是我的api

<?xml version="1.0" encoding="UTF-8"?>
<api context="/test" name="test" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET">
        <inSequence>
            <property name="ROOT" scope="default">
                <root:movie xmlns:root="www.wso2esb.com"/>
            </property>
            <log level="full"/>
            <clone continueParent="true" id="movie" sequential="true">
                <target>
                    <sequence>
                        <send>
                            <endpoint>
                                <address format="rest" uri="https://api.themoviedb.org/3/movie/tt0918940?api_key=code"/>
                            </endpoint>
                        </send>
                    </sequence>
                </target>
                <target>
                    <sequence>
                        <send>
                            <endpoint>
                                <address format="rest" uri="https://www.omdbapi.com/?type=movie&amp;i=tt0918940"/>
                            </endpoint>
                        </send>
                    </sequence>
                </target>
            </clone>
        </inSequence>
        <outSequence>
            <aggregate id="movie">
                <completeCondition>
                    <messageCount max="-1" min="-1"/>
                </completeCondition>
                <onComplete enclosingElementProperty="ROOT" expression="//jsonObject/*" xmlns:dummy="http://org.dummy" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                    <datamapper config="gov:datamapper/TestMapping.dmc" inputSchema="gov:datamapper/TestMapping_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/TestMapping_outputSchema.json" outputType="JSON"/>
            <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
            <respond/>
                </onComplete>
            </aggregate>

        </outSequence>
    </resource>
</api>

这是我的日志

[2016-07-21 09:33:56,180] ERROR - SequenceMediator Runtime error occurred while mediating the message
java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    at org.wso2.carbon.mediator.datamapper.engine.input.readers.JSONInputReader.readFromInputStream(JSONInputReader.java:76)
    at org.wso2.carbon.mediator.datamapper.engine.input.readers.JSONInputReader.read(JSONInputReader.java:59)
    at org.wso2.carbon.mediator.datamapper.engine.input.InputBuilder.buildInputModel(InputBuilder.java:59)
    at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:67)
    at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:306)
    at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:256)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:95)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:57)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
    at org.apache.synapse.mediators.eip.aggregator.AggregateMediator.completeAggregate(AggregateMediator.java:447)
    at org.apache.synapse.mediators.eip.aggregator.AggregateMediator.mediate(AggregateMediator.java:330)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:95)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:57)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
    at org.apache.synapse.rest.Resource.process(Resource.java:325)
    at org.apache.synapse.rest.API.process(API.java:338)
    at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:125)
    at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
    at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:56)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:300)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:255)
    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)

1 个答案:

答案 0 :(得分:1)

请检查您的治理注册表是否正确地将配置添加到ESB中。 (导航到Governance registry)

enter image description here

您将获得空指针异常,因为它无法找到相关详细信息。请添加相关配置并进行测试。