You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Tech Bolek <te...@yahoo.com.INVALID> on 2014/10/27 20:46:50 UTC

java.lang.NoClassDefFoundError: org/apache/synapse/task/Task when deploying custom task

I deployed a simple custom task placing it in lib/endorsed. At startup, synapse find the class with my custom task alright but it cannot find it's own Task interface. The Task interface is defined in synapse-tasks-2.1.0.jar and I verified the jar is included in synapse classpath.
My custom 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");
  }
}


Synapse config file:

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



Re: java.lang.NoClassDefFoundError: org/apache/synapse/task/Task when deploying custom task

Posted by Tech Bolek <te...@yahoo.com.INVALID>.
That was it.Thanks! 

     On Tuesday, October 28, 2014 3:57 PM, Hiranya Jayathilaka <hi...@gmail.com> wrote:
   

 Have you tried placing your jar in the lib directory instead of lib/endorsed? We typically don't use the endorsed directory to place custom code.

Thanks,
Hiranya

On Oct 27, 2014, at 12:46 PM, Tech Bolek <te...@yahoo.com.INVALID> wrote:

> I deployed a simple custom task placing it in lib/endorsed. At startup, synapse find the class with my custom task alright but it cannot find it's own Task interface. The Task interface is defined in synapse-tasks-2.1.0.jar and I verified the jar is included in synapse classpath.
> My custom 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");
>  }
> }
> 
> 
> Synapse config file:
> 
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>    <task class="com.mytest.synapse.MyTask" name="Task1">
>        <trigger interval="5"/>
>    </task>
> </definitions>
> 
> 

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: hiranya@cs.ucsb.edu;  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com


   

Re: java.lang.NoClassDefFoundError: org/apache/synapse/task/Task when deploying custom task

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
Have you tried placing your jar in the lib directory instead of lib/endorsed? We typically don't use the endorsed directory to place custom code.

Thanks,
Hiranya

On Oct 27, 2014, at 12:46 PM, Tech Bolek <te...@yahoo.com.INVALID> wrote:

> I deployed a simple custom task placing it in lib/endorsed. At startup, synapse find the class with my custom task alright but it cannot find it's own Task interface. The Task interface is defined in synapse-tasks-2.1.0.jar and I verified the jar is included in synapse classpath.
> My custom 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");
>  }
> }
> 
> 
> Synapse config file:
> 
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>    <task class="com.mytest.synapse.MyTask" name="Task1">
>        <trigger interval="5"/>
>    </task>
> </definitions>
> 
> 

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: hiranya@cs.ucsb.edu;  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com