[rules-users] Drools fusion how to I catch an Exception

Wolfgang Laun wolfgang.laun at gmail.com
Wed Sep 5 09:52:01 EDT 2012


This is what I get on standard output when I run your code with 5.4.0
(only renamed the main class and the package):

Unable to Analyse Expression System.out.println( "After5 then start" );
                m.status=$m.status;
                System.out.println( "After5 then stop" );
                drools.retract(m);:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.$m()]
[Near : {... m.status=$m.status; ....}]
                      ^
[Line: 19, Column: 0] : [Rule name='After5']

java.lang.IllegalArgumentException: Could not parse knowledge.
	at baddrl.Main.readKnowledgeBase(Main.java:66)
	at baddrl.Main.main(Main.java:29)



On 05/09/2012, RichardAmbridge <richard.ambridge at gmail.com> wrote:
> What is flagging an error for you?
>
> Eclipse plugin shows error, but it compiles.
>
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> 		kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
> 				ResourceType.DRL);
> 		*KnowledgeBuilderErrors errors = kbuilder.getErrors();*
> 		if (errors.size() > 0) {
> 			for (KnowledgeBuilderError error : errors) {
> 				System.err.println(error);
> 			}
> 			throw new IllegalArgumentException("Could not parse knowledge.");
> 		}
>
> The getErrors() doesn't return any errors.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-fusion-how-to-I-catch-an-Exception-tp4019597p4019601.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