Mohammad Irfan
Mohammad Irfan

Reputation: 89

WSO2ESB Custom Mediator Java Class is not found in the path

I have created the project using WSO2 Developer Studio. Under src/main/java I created the package samples.mediators In that package the class UnzipFileMediator:

package samples.mediators;
import org.apache.synapse.MessageContext; 
import org.apache.synapse.mediators.AbstractMediator;

public class UnzipFileMediator extends AbstractMediator {
    public boolean mediate(MessageContext context) { 
        // TODO Implement your mediation logic here 
        System.out.println("UnzipFile Mediation entered");
        return true;
    }
}

To deploy the code an followed this instructions:

  1. Right click on the project and select Export Project as Deployable Archive.

  2. It created the jar file named Unzip.jar

  3. I deployed the Jar file in to <ESB_HOME>/repository/components/lib directory.

In the synapse configuration I call the class like this

<class name="samples.mediators.UnzipFileMediator"></class>

but when i try to save it.It generate the below error:

org.apache.axis2.AxisFault: Class samples.mediators.UnzipFileMediator not found in the path

What am I doing wrong here?

Upvotes: 3

Views: 1628

Answers (1)

Philipp
Philipp

Reputation: 4749

Use a different package name.

Because the namespace (or package) samples.mediators is already used by WSO2 in a different jar. You had deployed now a second jar with the same package name, these classes will not be found in the Classpath by WSO2.

Choose for your own classes a correct package (namespace) with your company name like com.mycompany.mediators.

Upvotes: 4

Related Questions