[rules-users] uninformative rule parsing/compiling error -> org.drools.rule.Rule cannot be cast to org.drools.rule.Query

De Rooms Brecht bderooms at vub.ac.be
Thu Jul 25 12:58:44 EDT 2013


Op 24/07/2013 14:24, Davide Sottara schreef:
> Two clarifications first:
>
> 1) Which version are you using?
>
Version 5.4.0.Final
> 2) Is TrackerUpdate a static class inside TrackerRemote?
> In case, could you post the exact "import" statements you are using?
>
It is a normal class inside TrackerRemote.
   public class TrackerRemote extends vrpn.VRPNDevice implements 
java.lang.Runnable {
      public class TrackerUpdate {...

I imported:
import vrpn.TrackerRemote;

and used it as follows:
rule "TrackerRemote.TrackerUpdate"
     when
         message:TrackerRemote.TrackerUpdate()
     then
         System.out.println("Tracker: " + message);
end

Extra information:
I have been trying to add type declarations in one file and import them 
in another and I get exactly the same error message. There I did this:
     package derooms.be.testRule
     declare TestEvent
        @typesafe(false)
        number : int
        message : String
     end

and then a rule:
   package derooms.be.testRule
   rule "TestEvent"
         when
             event:TestEvent(message == "doesDynamicEventTypeWork?")
         then
             System.out.println("Got Event: " + event.data);
     end





More information about the rules-users mailing list