Drools使用

中文博客,Drools的文章都是抄来抄去,真遇到点儿事,嘛都查不到,昨个儿遇到此问题

java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl

google到一个英文论坛(http://comments.gmane.org/gmane.comp.java.drools.user/32524)

大约是有两个bundle中有同一个名字的包,一个是接口,一个是实现,运行时实现的那个包被drop了,

 

我们分析良久,认定问题的原因必然是classloader不对,网上一个国际友人说的对:

  1. org.drools.concurrent.ExecutorProviderFactory$ExecutorProviderHolder tries to obtain instance of class org.drools.concurrent.ExecutorProvider using org.drools.util.ServiceRegistryImpl.get method
  2. org.drools.util.ServiceRegistryImpl doesn't have any implementation of org.drools.concurrent.ExecutorProvider in it's registry
  3. org.drools.util.ServiceRegistryImpl tries to instantiate default implementation - org.drools.concurrent.ExecutorProviderImpl using org.drools.util.ServiceRegistryImpl$ReflectionInstantiator using wrong classloader - in my opinion there is problem.
  4. Finally java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl is thrown because classloader from bundle knowledge-api-5.4.0.Final cannot load class org.drools.concurrent.ExecutorProviderImpl.

他提供的方法如下:

This type of problems in OSGi environment were solved by registering proper instances in OSGi service repository. For example for core module in org.drools.osgi.core.Activator class. Maybe would be worth to register also org.drools.concurrent.ExecutorProviderImpl as OSGi service. I've tried to fix this problem this and this way solves this problem.

 

连接:https://community.jboss.org/message/758994#758994

你可能感兴趣的:(Drools)