0

As i want to read json file using mule requester but while deploying the code itself it's getting failed. Could you please check and help on this

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:mulerequester="http://www.mulesoft.org/schema/mule/mulerequester" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/mulerequester http://www.mulesoft.org/schema/mule/mulerequester/current/mule-mulerequester.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
    <mulerequester:config name="Mule_Requester" doc:name="Mule Requester"/>
    <flow name="mulerequestertestFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/>
        <mulerequester:request config-ref="Mule_Requester" resource="file:///C:/temp" doc:name="Mule Requester"/>
        <byte-array-to-string-transformer doc:name="Byte Array to String"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

and Getting below error

ERROR 2017-07-10 12:54:40,427 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'mulerequester:config'. One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[?:?]
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[?:?]
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[?:?]
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[?:?]
Gopi
  • 105
  • 1
  • 7
  • 24

2 Answers2

0

The mulerequester:config is outdated and not necessary anymore.

Remove line:

<mulerequester:config name="Mule_Requester" doc:name="Mule Requester"/>

Instead, create a new file-connector config and reference your mule-requester to this config:

<file:connector name="file-connector" autoDelete="false" streaming="true" validateConnections="true" doc:name="File"/>
<flow...>
   ...
<mulerequester:request resource="file://src/main/resources/somefile.txt?connector=file-connector" doc:name="Retrieve File" />
</flow>

This should deploy your app without problems.

NOTE: the file-connector config contains all the settings that you need to modify in order to read the proper folder, etc ...

mario martinez
  • 297
  • 2
  • 11
  • Configured readFromDirectory property to read the file and Getting below as per above configuration : The endpoint "file-connector" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead. – Gopi Jul 10 '17 at 10:26
  • is this happening during runtime or deployment ? – mario martinez Jul 10 '17 at 10:28
  • During deployment. I got the solution, we have to configure resource as file://C:/temp?connector=file-connector. Thanks Mario – Gopi Jul 10 '17 at 10:39
  • let me fix the answer them, please choose the answer as the proper one for the rest of the forum – mario martinez Jul 10 '17 at 10:43
0

Many people face this error when they are using various connectors,So I want to given an answer which is helpful to all.When you get this particular error "Invalid content was found starting with element" it means the Jar is not available.whatever connector you use(netsuite,zuora,salesforce,mulerequester etc) if you get this error just right click on the connector and give add libraries to the project and it will fix the issue.

Satheesh Kumar
  • 797
  • 7
  • 31