I have below mule flow to convert xml messages to flat format and trnsfer then to ftp according to type of input xml file (Using choice). But once I put a message it gives below exceptions. Can you guys please help to identify the problem.
<flow name="AWOutboundFlow">
<file:inbound-endpoint path="E:\MuleTemp\DBS\outbound\aw\in" responseTimeout="10000" doc:name="File"/>
<set-variable variableName="millis" value="#[System.currentTimeMillis()]" doc:name="Variable"/>
<logger message="#[flowVars['millis']]" level="INFO" doc:name="Logger"/>
<choice doc:name="Choice">
<when expression="#[xpath3('/cw:UniversalShipment/cw:Shipment/cw:TransportMode/cw:Code') == 'AIR']">
<logger message="#[flowVars['millis']]: Classified to AW" level="INFO" doc:name="Logger"/>
<mulexml:jaxb-xml-to-object-transformer returnClass="com.chasoft.schema.UniversalShipmentData" encoding="UTF-8" mimeType="text/xml" jaxbContext-ref="JAXB_Context" doc:name="XML to JAXB Object"/>
<transformer ref="AWShipmentOutbound" doc:name="Transformer Reference"/>
<ftp:outbound-endpoint binary="true" host="localhost" port="21" path="/outbound/aw/out" user="DBS" password="502011" responseTimeout="60000" doc:name="FTP" outputPattern="aw_out_#[flowVars['millis']].dat" encoding="UTF-8">
<reconnect frequency="10000"/>
</ftp:outbound-endpoint>
</when>
<when expression="#[xpath3('/cw:UniversalShipment/cw:Shipment/cw:TransportMode/cw:Code') == 'SEA']">
<logger message="#[flowVars['millis']]: Classified to BL" level="INFO" doc:name="Logger"/>
<mulexml:jaxb-xml-to-object-transformer returnClass="com.chasoft.schema.UniversalShipmentData" encoding="UTF-8" mimeType="text/xml" jaxbContext-ref="JAXB_Context" doc:name="XML to JAXB Object"/>
<transformer ref="BLShipmentOutbound" doc:name="Transformer Reference"/>
<ftp:outbound-endpoint binary="true" host="localhost" port="21" path="/outbound/bl/out" user="DBS" password="502011" responseTimeout="60000" doc:name="FTP" outputPattern="bl_out_#[flowVars['millis']].dat"/>
</when>
<when expression="#[xpath3('/cw:UniversalEvent/cw:Event/cw:EventTime') != '']">
<logger message="#[flowVars['millis']]: Classified toEVENT" level="INFO" doc:name="Logger"/>
<mulexml:jaxb-xml-to-object-transformer jaxbContext-ref="JAXB_Context" doc:name="XML to JAXB Object" encoding="UTF-8" mimeType="text/xml" returnClass="com.chasoft.schema.UniversalEventData"/>
<transformer ref="EventOutbound" doc:name="Transformer Reference"/>
<ftp:outbound-endpoint binary="true" host="localhost" port="21" path="/outbound/event/out" user="DBS" password="502011" responseTimeout="60000" doc:name="FTP" outputPattern="event_out_#[flowVars['millis']].dat"/>
</when>
<otherwise>
<logger level="INFO" message="#[flowVars['millis']]: UNKNOWN Classification" doc:name="Logger"/>
</otherwise>
</choice>
</flow>
Scratch of sample input file:
<UniversalShipment xmlns="http://www.cargowise.com/Schemas/Universal/2011/11" version="1.1">
<Shipment>
.....
<TransportMode>
<Code>AIR</Code>
<Description>Air Freight</Description>
</TransportMode>
Exception:
ERROR 2016-01-27 23:03:17,453 [[dbschenker].AWOutboundFlow.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy: Message : Execution of the expression "xpath3('/cw:UniversalShipment/cw:Shipment/cw:TransportMode/cw:Code') == 'SEA'" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: DeferredDocumentImpl Type : org.mule.api.MessagingException Code : MULE_ERROR--2 JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html Payload : [#document: null]
Exception stack is: 1. Stream Closed (java.io.IOException) java.io.FileInputStream:-2 (null) 2. java.io.IOException: Stream Closed (org.mule.api.MuleRuntimeException) org.mule.module.xml.el.XPath3Function:151 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MuleRuntimeException.html) 3. [Error: java.io.IOException: Stream Closed] [Near : {... xpath3('/cw:UniversalShipment/ ....}] ^ [Line: 1, Column: 1] (org.mule.mvel2.CompileException) org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:438 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/mvel2/CompileException.html) 4. Execution of the expression "xpath3('/cw:UniversalShipment/cw:Shipment/cw:TransportMode/cw:Code') == 'SEA'" failed. (org.mule.api.expression.ExpressionRuntimeException) org.mule.el.mvel.MVELExpressionLanguage:232 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html) 5. Execution of the expression "xpath3('/cw:UniversalShipment/cw:Shipment/cw:TransportMode/cw:Code') == 'SEA'" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: DeferredDocumentImpl (org.mule.api.MessagingException) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)