I think this one is going to be hard to repro in a minimal unit test. our
unit tests on this file always run successfully; it's only when deploying
into the server with spring and the resource change scanner live that I see
the problem. I hesitated to post this one at all to the user forum because
I know it will be hard to reproduce. Mostly I wondered if anyone had
suggestions to troubleshoot other than what I've already tried.
If someone can point me to Drools code to compile the file the way it would
happen when Spring loads it, I could test with that and see if I can
reproduce the problem.
This is how I compile the file for unit testing. Is the compile path
different when loaded via Spring?
public static KnowledgeBase createKnowledgeBaseFromRulesFile(String path)
throws Exception {
KnowledgeBuilder kb = KnowledgeBuilderFactory.newKnowledgeBuilder();
try {
kb.add(ResourceFactory.newFileResource(path), ResourceType.DRL);
} catch (Exception e) {
if (kb.hasErrors()) {
throw new RuntimeException(kb.getErrors().toString());
} else {
throw e;
}
}
if (kb.hasErrors()) {
System.out.println(kb.getErrors());
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(getKnowledgeBaseConfiguration());
kbase.addKnowledgePackages(kb.getKnowledgePackages());
return kbase;
}
--
View this message in context:
http://drools.46999.n3.nabble.com/Compiled-rules-differ-KnowledgeAgent-vs...
Sent from the Drools: User forum mailing list archive at
Nabble.com.