[rules-users] Compiled rules differ KnowledgeAgent vs ResourceChangeScanner

Mark Proctor mproctor at codehaus.org
Sun Jul 15 03:59:26 EDT 2012


The bean builder factory is here:
https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/main/java/org/drools/container/spring/beans/KnowledgeBaseBeanFactory.java

Mark

On 15/07/2012 03:43, lhorton wrote:
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list