filewso2wso2-enterprise-integratorconnector

WSO2 Microintegrator: Error - Mediator from connector File not recognized


For a WSO2 Microintegrator project, I need to read a JSON file. To practice the use of the File connector (Read mediator) I did this:

The code of the project is this:

<api context="/read" name="init" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" uri-template="/json">
        <inSequence>
            <file.read configKey="FILE_CONNECTION_1">
                <path>test.json</path>
                <readMode>Complete File</readMode>
                <includeResultTo>Message Body</includeResultTo>
                <enableStreaming>false</enableStreaming>
                <enableLock>false</enableLock>
            </file.read>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>

As simple as a REST API that triggers a file read operation. When export artifacts and run this on the integrated server of Integration Studio, the message

Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}file

appears and the application is undeployed. I think this problem has been already reported but no solution was given. Could it be a problem of versions of connector and server or Integration Studio? Studio version: 8.2.0 Server version: 4.2.0 (and also 4.3.0 in external server with same result) File connector version: 4.0.32

Some idea? Other suggested connectors? Thanks in advance


Solution

  • @Fidel, It seems even though you have created the Connector exporter project, you have not imported the connectors to it. The connector exporter will be available in the Composite Exporter selection window only if it contains at least one connector. Therefore can you try to add the connector to the Connector exporter and try it as follows,

    1. Right-click on the created connector exporter project, point to New and then click Add/Remove Connectors.
    2. Select Add Connector/module and click Next. Then, click on the Workspace option. This will list down the connectors that have been imported into WSO2 Integration Studio.

    Add connector to exporter

    For more information on packaging artifacts refer the documentation https://mi.docs.wso2.com/en/4.2.0/develop/creating-artifacts/adding-connectors/#packaging-connectors