Hello everyone,
I'm struggling with the following error after updating from Drools 5.1M1 to
5.3Final when handing over a URLClassloader as a parameter for
RuleBaseConfiguration. The URL of the classLoader points to Jar file
containing the facts.
ERROR JobRunShell - Job TIQRULES_PROJECT4.TIQRULES_PROJECT4 threw an
unhandled Exception:
java.lang.NoSuchMethodError:
org.drools.RuleBaseConfiguration.<init>([Ljava/lang/ClassLoader;)V
at
de.tiq.rules.drools.DroolsEngine.createKnowledgeBase(DroolsEngine.java:263)
at
de.tiq.rules.drools.DroolsEngine.run(DroolsEngine.java:95)
at
de.tiq.rules.TIQRulesEngine.executeRuleResource(TIQRulesEngine.java:178)
at
de.tiq.quartz.QuartzTaskExecutor.execute(QuartzTaskExecutor.java:173)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
ERROR ErrorLogger - Job (TIQRULES_PROJECT4.TIQRULES_PROJECT4 threw an
exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested
exception: java.lang.NoSuchMethodError:
org.drools.RuleBaseConfiguration.<init>([Ljava/lang/ClassLoader;)V]
at org.quartz.core.JobRunShell.run(JobRunShell.java:210)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
Caused by: java.lang.NoSuchMethodError:
org.drools.RuleBaseConfiguration.<init>([Ljava/lang/ClassLoader;)V
at
de.tiq.rules.drools.DroolsEngine.createKnowledgeBase(DroolsEngine.java:263)
at
de.tiq.rules.drools.DroolsEngine.run(DroolsEngine.java:95)
at
de.tiq.rules.TIQRulesEngine.executeRuleResource(TIQRulesEngine.java:178)
at
de.tiq.quartz.QuartzTaskExecutor.execute(QuartzTaskExecutor.java:173)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
This is the part of the code where the ClassLoader is given as a parameter:
/**
* create a knowledge base of a given rule resource
*
* @param ruleResource
* the rule resource
* @return the created knowledge base
*/
private KnowledgeBase createKnowledgeBase(IRuleResource
ruleResource) {
if (ruleResource == null) {
throw new
NullPointerException("ruleResource is null");
}
KnowledgeBase kbase;
ClassLoader[] arrayOfClassLoaders = new
ClassLoader[1];
arrayOfClassLoaders[0] =
currProject.getFactsClassLoader();
final KnowledgeBaseConfiguration kbaseconfig
= new RuleBaseConfiguration(currProject.getFactsClassLoader());
kbase =
KnowledgeBaseFactory.newKnowledgeBase(kbaseconfig);
kbase.addKnowledgePackages(ruleResource.getKnowledgePackages(kbase));
return kbase;
}
This is what getFactsClassLoader does:
public ClassLoader getFactsClassLoader() {
try {
if (factsClassLoader == null) {
URL jarURL;
jarURL = getExecuteJarFile().toURI().toURL();
factsClassLoader = new URLClassLoader(new URL[] { jarURL },
Thread.currentThread()
.getContextClassLoader());
}
return factsClassLoader;
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
}
Thx in advance for any hint on solving the mentioned problem!
--
View this message in context:
http://drools.46999.n3.nabble.com/ClassLoader-parameter-and-Init-function...
Sent from the Drools: User forum mailing list archive at
Nabble.com.