Search code examples
apache-synapse

Apache synapse: java.lang.NoClassDefFoundError: org/apache/synapse/task/Task


I deployed a simple custom task. At startup, synapse does find the class with my custom task but it cannot find it's own Task interface. Strange. The Task interface is defined in synapse-tasks-2.1.0.jar and I verified the jar is included in synapse classpath.

  1. My task:

    package com.mytest.synapse;
    import org.apache.synapse.task.Task;
    public class MyTask implements Task {
      @Override
      public void execute() {
        System.out.println("my task in action");
      }
    }
    
  2. Synapse config file:

    <definitions xmlns="http://ws.apache.org/ns/synapse">
        <task class="com.mytest.synapse.MyTask" name="Task1">
            <trigger interval="5"/>
        </task>
    </definitions>
    

Solution

  • Looks like the custom jars are to be placed in lib, not in lib/endorsed. Per instructions I got from a synapse developer I moved my custom from lib/endorsed to lib and it worked.