[rules-users] Compiled rules differ KnowledgeAgent vs ResourceChangeScanner

lhorton LHorton at ABCLegal.com
Sat Jul 14 22:43:31 EDT 2012


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-ResourceChangeScanner-tp4018608p4018692.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list