Hello ALL,

I'm facing an issue, and I don't know how to solve it, indeed In our
project we 're using activiti in karaf , and this is my problematic,

1- I have bundle A  who exposes a webservice using cxf say that the
webservice class is MyAWebService, and we have a bundle B which contains
class MyBWebService the sub class of MyAWebService
(MyAWebService extends MyBWebService ).

2- in our activiti process we define a Listner  MyTaskListner(implementing
TaskListner) as Class it means it will be instanciated by Activiti engine.
the class listner islocated in bundle B.

Thus when I run my workflow, and when activiti try to instanciate
MyTaskListner, it throws "can't instanciate...." which is in the real
NoClassFoundException,
because the classloader trying to load this class cna not get it, and this
is why, indeed activiti , because of the ClassDelegate of activit when it
runs its method
notify, it trys to instanciate MyTaskListner, and thus to load it using the
org.activiti.engine.impl.util.ReflectUtil.loadClass() method (code below)
so my problem is that  Thread.currentThread().getContextClassLoader()
returns  a BundleDelegatingClassLoader on bundle A , which not contains
MyTaskListner class.

1-so my first question is what BundleDelegatingClassLoader  does really?
2- which workaround could I use to force the  BundleDelegatingClassLoader
to looks to my bundle B

Thanks  a lot  for your Help

  public static Class<?> loadClass(String className) {
   Class<?> clazz = null;
   ClassLoader classLoader = getCustomClassLoader();

   // First exception in chain of classloaders will be used as cause when
no class is found in any of them
   Throwable throwable = null;

   if(classLoader != null) {
     try {
       LOG.trace("Trying to load class with custom classloader: {}",
className);
       clazz = loadClass(classLoader, className);
     } catch(Throwable t) {
       throwable = t;
     }
   }
   if(clazz == null) {
     try {
       LOG.trace("Trying to load class with current thread context
classloader: {}", className);
       clazz = loadClass(Thread.currentThread().getContextClassLoader(),
className);
     } catch(Throwable t) {
       if(throwable == null) {
         throwable = t;
       }
     }
     if(clazz == null) {
       try {
         LOG.trace("Trying to load class with local classloader: {}",
className);
         clazz = loadClass(ReflectUtil.class.getClassLoader(), className);
       } catch(Throwable t) {
         if(throwable == null) {
           throwable = t;
         }
       }
     }
   }

   if(clazz == null) {
     throw new ActivitiClassLoadingException(className, throwable);
   }
   return clazz;
  }
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to