mjvid
mjvid

Reputation: 21

Using wso2-esb for file processing

I'm trying to use wso2 ESB to pick a file from the local directory and insert the records in the file to a database and to send an email.

Followed steps given in https://docs.wso2.com/display/ESB490/Sample+271%3A+File+Processing

Below is smooks-config file

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">

<!--Configure the CSVParser to parse the message into a stream of SAX events. -->
<resource-config selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVParser</resource>
<param name="fields" type="string-list">name,surname,phone</param> 
</resource-config>                         
</smooks-resource-list>

This is the error showing in ESB server

org.milyn.SmooksException: Failed to filter source.
    at     org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:97)
    at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:64)
    at org.milyn.Smooks._filter(Smooks.java:526)
    at org.milyn.Smooks.filterSource(Smooks.java:482)
    at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:140)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
    at org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:80)
    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)
 Caused by: java.lang.ClassNotFoundException: org/milyn/csv/CSVParser
     at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
    at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
    at org.milyn.delivery.AbstractParser.createXMLReader(AbstractParser.java:291)
    at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:62)
    at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:86)
    ... 11 more
[2016-10-30 15:01:50,111] ERROR - SequenceMediator Failed to filter source.          Caused by Failed to filter source.
org.wso2.carbon.mediator.service.MediatorException: Failed to filter source.    Caused by Failed to filter source.
    at    org.wso2.carbon.mediator.transform.SmooksMediator.handleException(SmooksMediator.java:265)
    at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:160)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
    at org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:80)
    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)
[2016-10-30 15:01:50,153]  INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:f8385dfd-f7c7-42fa-a567-b234028d1c59, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Failed to filter source. Caused by Failed to filter source., Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">vidya,mj,123456789</text></soapenv:Body></soapenv:Envelope>

please help me out to solve this

Upvotes: 1

Views: 478

Answers (3)

Navaneeth
Navaneeth

Reputation: 51

ESB unable to load Class "org/milyn/csv/CSVParser" from corresponding Jar.

Search Jar file in Google. place that Jar inside extensions folder inside ESB_HOME/repository/components/..

restart ESB surely it will work

Upvotes: 0

mjvid
mjvid

Reputation: 21

Newer version milyn-smooks-all-1.5.1 jar doesn't have CSVParser so changing CSVParser to CSVReader in the smooks-config file solved the issue.

Upvotes: 1

Martin Hald
Martin Hald

Reputation: 676

Somehow the ESB cannot find the class. Can you please verify that milyn-smooks-csv-1.2.4.jar is located in "ESB_HOME"/repository/components/lib.

Upvotes: 0

Related Questions