EAGame
EAGame

Reputation: 85

ESB WSO2 | Trying to send an email through email connector and getting "org.wso2.carbon.connector.email.send cannot be found" error

I'm trying to send an email using email connector from esb wso2 but I'm getting this error:

Invoking Target EIP Sequence org.wso2.carbon.connector.email.send paramNames : [from, to, subject, content, contentType]
[2022-07-22 10:52:14,113] ERROR {org.apache.synapse.mediators.template.InvokeMediator} - Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,121] DEBUG {org.apache.synapse.debug.SynapseDebugManager} - Mediation flow terminated for id urn:uuid:3f3f9864-bbc1-4e95-a4bf-1574196dfb8c
[2022-07-22 10:52:14,121]  WARN {org.apache.synapse.core.axis2.SynapseMessageReceiver} - Executing fault handler due to exception encountered
[2022-07-22 10:52:14,121]  WARN {org.apache.synapse.FaultHandler} - ERROR_CODE : 0
[2022-07-22 10:52:14,121]  WARN {org.apache.synapse.FaultHandler} - ERROR_MESSAGE : Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,122]  WARN {org.apache.synapse.FaultHandler} - ERROR_DETAIL : org.apache.synapse.SynapseException: Sequence template org.wso2.carbon.connector.email.send cannot be found

This is my api which I use:

<?xml version="1.0" encoding="UTF-8"?>
<api context="/api/send/email" name="api.send.email" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST">
        <inSequence>
            <property expression="json-eval($.from)" name="from" scope="default" type="STRING"/>
            <property expression="json-eval($.to)" name="to" scope="default" type="STRING"/>
            <property expression="json-eval($.subject)" name="subject" scope="default" type="STRING"/>
            <property expression="json-eval($.content)" name="content" scope="default" type="STRING"/>
            <property expression="json-eval($.contentType)" name="contentType" scope="default" type="STRING"/>
            <log level="custom">
                <property expression="$ctx:from" name="Log_from:"/>
                <property expression="$ctx:to" name="Log_to:"/>
                <property expression="$ctx:subject" name="Log_subject:"/>
                <property expression="$ctx:content" name="Log_content:"/>
                <property expression="$ctx:contentType" name="Log_contentType:"/>
            </log>
            <email.send configKey="TEST_SMTP_CONNECTION">
                <from>{json-eval($.from)}</from>
                <to>{json-eval($.to)}</to>
                <subject>{json-eval($.subject)}</subject>
                <content>{json-eval($.content)}</content>
                <contentType>{json-eval($.contentType)}</contentType>
            </email.send>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>

I think the problem is based on the fact that I don't think I added the connector on my project in the correct way. So, first of all I added a connector on my main project (where I have APIs, endpoints etc) - Right Click - Add or Remove Connector/Module - then I added the email connector) Then I created a new Connector Exporter on my project (Right Click on an empty space on my Project Explorer - I named the exporter 'test' - and I think here is the problem: enter image description here

What Group ID, Parent Group ID and Parent Artifact ID I should choose? (same question when I'm making Composite Application for connector)

LATER EDIT*: When I'm deploying de car. app for the email connector I'm getting these errors:

Error in instantiating class : org.wso2.carbon.connector.operations.list.EmailGetAttachment java.lang.NoClassDefFoundError: org/wso2/carbon/connector/core/exception/ContentBuilderException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
Unable to update status for :  {org.wso2.carbon.connector}email :: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment org.apache.synapse.deployers.SynapseArtifactDeploymentException: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment

Upvotes: 0

Views: 369

Answers (1)

ycr
ycr

Reputation: 14604

To answer your questions, if you have a Maven MultiModule Project you can get the details of the parent project from the pom.xml of the parent project.(This is the root pom.xml typically)

The easiest way to resolve your problem is to create your project from an existing template which will make sure projects are created correctly. Inorder to do that, follow the steps below.

  1. Open Integration Studio and Go to Help -> Getting Started.

enter image description here

  1. Then select the Email Service sample project, give it a name and create the project.

enter image description here

  1. Now you should have a full working project with a Connector Exported.

enter image description here

In the future for creating new projects, you can refer to this document.

Upvotes: 1

Related Questions