2016-07-21 23 views
0

Ich versuche, den Data Mapper verwenden, um die Antwort von zwei (2) verschiedenen API zuordnen. Also habe ich den Klonmediator und den Aggregatmediator verwendet, um diese beiden api zusammenzuführen und dann mit dem Datenmapper abzubilden, aber wenn ich in den Datenmapperteil komme, erhalte ich immer einen Fehler. Es funktioniert, wenn ich den Data Mapper Mediator Teil entfernt habe.Wso2 Data Mapper SequenceMediator Laufzeitfehler

Hier ist meine 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> 

und hier ist mein log

[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) 

Antwort

1

Bitte überprüfen Sie Ihre Governance-Registry, ob Sie die Konfiguration korrekt in ESB hinzufügen. (Navigieren Sie zu Governance-Registrierung)

enter image description here

Sie Null-Zeiger Ausnahme erhalten, da es nicht relevanten Details finden können. Bitte relevante Konfigurationen hinzufügen und testen.

+0

Ich überprüfte meine Registrierung und es ist dort http://imgur.com/a/WHFEP –

+1

Eigenschaft vor dem Mapper Mediator hinzufügen. Dann sieht es so aus:

+0

Wenn Sie immer noch den Fehler bekommen, fügen Sie geloggte Daten hinzu, wie wir es setzen Log Mediator zwischen Property und Datamapper Mediator –