org.mule.module.launcher.DeploymentInitException: SAXParseException: Premature end of file - api

I am using mule API gateway , I have deployed my package in it. But in API gateway that
org.mule.module.launcher.DeploymentInitException: SAXParseException: Premature end of file.
I have tried in version 1.3.0 and 3.8.0. In both I got same error.
Please help me.
File :
<http:connector name="httpConnector" />
<esper:config name="esperModule" configuration="esper-config.xml" />
<mxml:dom-to-xml-transformer name="domToXmlTransformer" />
<flow name="websocket-esper-bridge">
<http:inbound-endpoint address="niohttp://localhost:8080/websocket/events"
exchange-pattern="one-way">
<http:websocket path="events" />
</http:inbound-endpoint>
<custom-processor
class="com.mulesoft.demo.mule.websocket.EsperWebSocketUpdateListener">
<spring:property name="esperModule" ref="esperModule" />
<spring:property name="httpConnector" ref="httpConnector" />
<spring:property name="domToXmlTransformer" ref="domToXmlTransformer" />
</custom-processor>
</flow>
<flow name="signupEventsGenerator">
<poll frequency="3000">
<set-payload value="<signup id='fake' />"/>
</poll>
<mxml:xml-to-dom-transformer returnClass="org.w3c.dom.Document" />
<esper:send eventName="SignupEvent" eventPayload-ref="#[message.payload]" />
</flow>

This is a current known issue with 3.8.0. The error is not very descriptive but it means you are missing a schema declaration for a component. Could you post the entire XML file contents? It's probably one you're using, like http, esper, mxml.
HTH

Related

override sessionHandler using http:listener-config

I need to migrate a http NoSessionConnector defined in mule 3.3.1 in this way:
<http:connector name="NoSessionConnector">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:connector>
to the new http:listener-config but I cannot put service-overrides inside http:listener-config tag nor inside http:listener tag. Both configurations are not permitted:
<http:listener-config name="httpListener" host="localhost">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:listener-config>
<http:listener config-ref="httpListener" path="/ecommerce/*">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:listener>
is there a way to configure a custom sessionHandler in mule 3.7.0? I need it to avoid a OptionalDataException as described on this stackoverflow
If the problem is the message property "MULE_SESSION" that is past as HTTP header, then you can try removing it from the outbound scope of the message in order to avoid sending "MULE_SESSION" as HTTP header. You can do it by using the "message-property-transformer" element:
<message-properties-transformer scope="outbound">
<delete-message-property key="MULE_SESSION" />
</message-properties-transformer>
Remember that you have to place it before the SOAP call in the flow.

Mule inbound endpoint is not picking file

<flow name="receive-files-from-client">
<file:inbound-endpoint connector-ref="ibFileConnector"
path="/client-data/accounts/client/ToTest">
<file:filename-wildcard-filter pattern="ABC_123*.txt, XYZ_987*.txt" />
<object-to-byte-array-transformer /> <!-- need to convert from an input stream to a byte array to avoid having the wire-tap close it -->
<wire-tap>
<file:outbound-endpoint path="${workingDdir}/Dir1/archive/inbound/#[function:datestamp-yyyy-MM-dd_HH-mm-ss.SSS]" />
</wire-tap>
</file:inbound-endpoint>
....
...
</flow>
I have Configured everything properly, But Mule is not picking the file from that inbound path location.
Use the following modified flow. You are using a file outbound inside a file inbound.
<flow name="receive-files-from-client">
<file:inbound-endpoint connector-ref="inboundFileConnector"
path="/client-ftpdata/ftpaccounts/client/To_CC-Test">
<file:filename-wildcard-filter pattern="CYC53_810*.txt,CYC53_855*.txt,CYC53_856*.txt,CYC53_997*.txt" />
<object-to-byte-array-transformer /> <!-- need to convert from an input stream to a byte array to avoid having the wire-tap close it -->
<wire-tap>
<file:outbound-endpoint path="${global.workdir}/suppliers/S000590/archive/inbound/#[function:datestamp-yyyy-MM-dd_HH-mm-ss.SSS]" />
</wire-tap>
</file:inbound-endpoint>
<wire-tap>
<file:outbound-endpoint path="${global.workdir}/suppliers/S000590/archive/inbound/#[function:datestamp-yyyy-MM-dd_HH-mm-ss.SSS]" />
</wire-tap>
....
...
</flow>
Try to execute your flow without filter and see if the flow is picking the files. If so modify your filter regular expression.
Hope this helps.

Seeing ConcurrentModificationException in Mule 3.3.0

I am fairly new to Mule ,using 3.3.0, but I am trying what I think should be a fairly stock example.
I have a mule config which will read a csv file and attempt to process the lines and columns of in different flows async. However, we are seeing ConcurrentModificationException when the message is being "handed off" to one of the async flows. I was wondering if anyone else has seen this issue and what they may have done to work around the problem.
java.util.ConcurrentModificationException
at org.apache.commons.collections.map.AbstractHashedMap$HashIterator.nextEntry(AbstractHashedMap.java:1113)
at org.apache.commons.collections.map.AbstractHashedMap$KeySetIterator.next(AbstractHashedMap.java:938)
at org.mule.DefaultMuleEvent.setMessage(DefaultMuleEvent.java:933)
at org.mule.DefaultMuleEvent.(DefaultMuleEvent.java:318)
at org.mule.DefaultMuleEvent.(DefaultMuleEvent.java:290)
at org.mule.DefaultMuleEvent.copy(DefaultMuleEvent.java:948)
<queued-asynchronous-processing-strategy poolExhaustedAction="RUN" name="commonProcessingStrategy" maxQueueSize="1000" doc:name="Queued Asynchronous Processing Strategy"/>
<file:connector name="inboundFileConnector" fileAge="1000" autoDelete="true" pollingFrequency="1000" workDirectory="C:/mule/orca/dataprovider/work"/>
<file:endpoint name="dataProviderInbound" path="C:\mule\orca\dataprovider\inbound" moveToPattern="#[function:datestamp]-#[header:originalFilename]" moveToDirectory="C:\mule\orca\dataprovider\history" connector-ref="inboundFileConnector" doc:name="Data Feed File" doc:description="new files are processed in 'work' folder, then moved to 'archive' folder"/>
<flow name="dataProviderFeedFlow">
<inbound-endpoint ref="dataProviderInbound"/>
<file:file-to-string-transformer />
<flow-ref name="dataSub"/>
</flow>
<sub-flow name="dataSub" >
<splitter expression="#[rows=org.mule.util.StringUtils.split(message.payload, '\n\r')]" />
<expression-transformer expression="#[org.mule.util.StringUtils.split(message.payload, ',')]" />
<foreach>
<flow-ref name="storageFlow" />
<flow-ref name="id" />
</foreach>
</sub-flow>
<flow name="storageFlow" processingStrategy="commonProcessingStrategy">
<logger level="INFO" message="calling the 'storageFlow' sub flow."/>
</flow>
<flow name="id" processingStrategy="commonProcessingStrategy">
<logger level="INFO" message="calling the 'id' sub flow."/>
</flow>
Here is a fixed version of the dataSub sub-flow that works fine:
<sub-flow name="dataSub">
<splitter expression="#[org.mule.util.StringUtils.split(message.payload, '\n\r')]" />
<splitter expression="#[org.mule.util.StringUtils.split(message.payload, ',')]" />
<flow-ref name="storageFlow" />
<all>
<async>
<flow-ref name="storageFlow" />
</async>
<async>
<flow-ref name="id" />
</async>
</all>
</sub-flow>
Notice that:
I use two splitter expressions,
I use an all message processor to ensure the same payload is sent to both private flows,
I have to wrap the flow-refs with an async message processor otherwise the invocation fails because the private flows are asynchronous but all forces synchronous.

mule weird flow behavior

I'm using mule 3.2.0 and
I'm invoking muleclient.send method in java-class which sends soap-request to a mule flow(not present here), which sends it to the http endpoint which receives request, logs it to my db with proxy pattern and propagates it to "ServiceFlow" which has Dispatcher transformer - java class, which uses invocation of MuleClient.send(String url, Object payload, Map messageProperties) method to dispatch one object of the payload array to an endpoint.
Then it gets processed by cxf:jax-ws-client, logged to a db once again and transferred to another instance of Dispatcher (where incoming payload is again of type Object[]). There I have http endpoint which does the service invocation. This part works okay.
But trouble appears at the receiving of the response. I've put Test1(2,3,4) transformers to print the invocation chain in my flows (They just do the System.out.println()), and saw that they're invoked in a weird sequence: I have it like 1,3 then TestTransformer (which is also the sysouter) then I get the error "NullPayload" in the caller of the main flow "Service flow" and then I receive the Test 4 and Test 2 outs. The responseTransformer-refs in patterns "1Proxy" are ignored, so as in "ServiceProxy". I've been looking for the solution for like a week now, and can't find it. In debugging, I can see that transformer called "TestTransformer" in has expected payload (Object[]) but when I receive it in my class caller, it appears as "NullPayload". I can see now that one of my endpoints has the path element instead of ref, not sure if this cause any impact on flow, but will check it. Also tried to use the "response" block to ensure my flow runs as expected. Any suggestions appreciated. Thanks
Here is what my config looks like:
<http:endpoint name="httpService" address="${service.soap}" exchange-pattern="request-response" responseTimeout="${timeout}" />
<vm:endpoint name="vmService" path="vmService" exchange-pattern="request-response"/>
<pattern:web-service-proxy
name="ServiceProxy"
inboundEndpoint-ref="httpService"
transformer-refs="to-string logging"
responseTransformer-refs="to-string logging"
outboundEndpoint-ref="vmService" />
<flow name="ServiceFlow" >
<inbound-endpoint ref="vmService"/>
<cxf:jaxws-service serviceClass="pkg.ServiceImpl" wsdlLocation="${service.wsdl}" enableMuleSoapHeaders="false" validationEnabled="true"/>
<custom-transformer class="pkg.Dispatcher">
<spring:property name="vmFlowPath" value="vm.logService"/>
</custom-transformer>
<custom-transformer name="TestTransformer" class="pkg.TestTransformer"/>
</flow>
<vm:endpoint name="vm1In" path="vm1In" exchange-pattern="request-response"/>
<vm:endpoint name="vm1Out" path="vm1Out" exchange-pattern="request-response"/>
<custom-transformer name="arrayGenerator" class="pkg.ArrayGenerator"/>
<custom-transformer name="objectExtractor" class="pkg.ObjectExtractor"/>
<custom-transformer name="faultChecker" class="pkg.FaultChecker"/>
<custom-transformer name="objectLogging" class="pkg.ObjectLogger">
<pattern:web-service-proxy
name="1Proxy"
inboundEndpoint-ref="vm1In"
transformer-refs="arrayGenerator objectLogging"
responseTransformer-refs="objectLogging objectExtractor faultChecker"
outboundEndpoint-ref="vm1Out" />
<flow name="logService">
<vm:inbound-endpoint path="vm.logService exchange-pattern="request-response"/>
<custom-transformer class="Test1"/>
<vm:outbound-endpoint ref="vm1In">
<cxf:jaxws-client
serviceClass="pkg.ServiceImpl"
operation="import"
enableMuleSoapHeaders="false"/>
<object-to-string-transformer/>
</vm:outbound-endpoint>
<object-to-xml-transformer>
<xm:xml-to-object-transformer returnClass="pkg.WSResponseClass"/>
<custom-transformer class="Test2"/>
</flow>
<flow name="DispatcherToServiceFlow">
<custom-transformer class="Test3"/>
<vm:inbound-endpoint path="vm1.Out"/>
<custom-transformer class="pkg.Dispatcher">
<spring:property name="vmFlowPath" value="vm.import"/>
</custom-transformer>
</flow>
<flow name="import">
<vm:inbound-endpoint path="vm.import" exchange-pattern="request-response"/>
<http:outbound-endpoint address="${importService}" responseTimeout="${timeout}" exchange-pattern="request-response" />
<object-to-string-transformer/>
<custom-transformer class="Test4"/>
</flow>
well, my problem really was the "path" element instead of referring to an existing vm endpoint with "ref" element like
<inbound-endpoint ref="vm1Out"/>

Mule 3.2 flow and cxf:jaxws-service

I am relatively new to mule and trying to define a mule flow which takes request XML via soap-based Web service. The XML is based on a complex schema and I have generated classes using WSDL2Java
After receiving the request cxf:jaxws-service executes the method submitOrder(SubmitOrderRequest parameters). After this method's execution I would like to transform the request XML to a little bit different format. Then this XML needs to be forwarded to another web service. The problem is that the mule message that comes out of ServiceImpl contains SubmitOrderResponse whereas I still want to work on SubmitOrderRequest.
<flow name="testService">
<http:inbound-endpoint address="http://localhost:62005/test"
exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.test.ServicePortType" />
</http:inbound-endpoint>
<component class="com.test.ServiceImpl" />
<!-- transformer ref="MVIRequestTransformer" / -->
<!-- xm:object-to-xml-transformer / -->
<!-- logger message="XML payload is #[payload]" level="INFO" / -->
<!-- SEND TRASNFORMED MESSAGE TO ANOTHER SERVICE -->
</flow>
#WebService(endpointInterface = "com.pennmutual.services.mvi.MVIServicePort")
public class ServiceImpl implements ServicePortType {
...
#Override
public SubmitOrderResponse submitOrder(SubmitOrderRequest parameters) {
...
}
...
}
What are my options are. I can think of the following –
1. Put the request object somewhere in the context and retreive it later on for processing.
2. Change the return type of submitOrder to Object and return SubmitOrderRequest instead of SubmitOrderResponse.
Please suggest the best possible way to handle this situation. I am using mule 3.2.
I think there are two elegant way to do that (excluding the one that involves changing the webservice interface)
Store the request into a session variable and restore it afterwards.
Here is how your flow would look like:
<flow name="testService">
<http:inbound-endpoint address="http://localhost:62005/test" exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.test.ServicePortType" />
</http:inbound-endpoint>
<message-properties-transformer scope="session">
<add-message-property value="payload" key="originalPayload" />
</message-properties-transformer>
<component class="com.test.ServiceImpl" />
</flow>
Use the enricher around the component to store the returned value into a variable so that it won't become the payload of your flow. Following an example of how to achieve this
<flow name="Echo" doc:name="Echo">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="6090" path="echo" encoding="UTF-8" />
<cxf:jaxws-service serviceClass="org.mule.example.echo.Echo" />
<enricher target="#[variable:echo]">
<component class="org.mule.example.echo.Echo" />
</enricher>
<logger level="ERROR" message="#[variable:echo]"/>
</flow>
You can find more informations on the enricher here