[rules-users] drools-ant task and java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase

Mark Proctor mproctor at codehaus.org
Mon Jul 7 20:45:41 EDT 2008


no don't think so, please open a jira and we will fix this for 4.0.8.

Mark
Ojwang Wilson O wrote:
> All,
>
> I was succesfull in building rules pkg from drl using drools-ant task, 
> but when I used the generated pkg in the code below
>
> =============
>            File rulesDir = new 
> File("/home/droolsuser/workspace_ant/AntDroolsTest/build/pkgrules/");
>            String rulesdir = rulesDir.getAbsolutePath();
>            Properties prop = new Properties();
>            //prop.setProperty("file", ruleFile);
>            prop.setProperty("dir",rulesdir);
>            prop.setProperty("newInstance", "false");
>            prop.setProperty("localCacheDir", ".");
>            prop.setProperty("poll", "300"); // poll every 300 seconds 
> for hot deployment.
>                      //Get a new RuleBase using these properties
>            RuleAgent agent = RuleAgent.newRuleAgent(prop); 
> -------------------->Error line
>            RuleBase ruleBase = agent.getRuleBase();
> ==========
>
> I encountered the following error.
> =========
>     [java] RuleAgent(default) INFO (Mon Jul 07 18:58:30 CDT 2008): 
> Configuring with newInstance=false, secondsToRefresh=300
>     [java] RuleAgent(default) INFO (Mon Jul 07 18:58:30 CDT 2008): 
> Configuring package provider : DirectoryScanner scanning dir: 
> /home/droolsuser/workspace_ant/AntDroolsTest/build/pkgrules found 1 
> file(s).
>     [java] java.lang.ClassCastException: 
> org.drools.reteoo.ReteooRuleBase cannot be cast to 
> org.drools.rule.Package
>     [java]     at 
> org.drools.agent.FileScanner.readPackage(FileScanner.java:112)
>     [java]     at 
> org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
>     [java]     at 
> org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
>     [java]     at 
> org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43) 
>
>     [java]     at 
> org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
>     [java]     at 
> org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
>     [java]     at 
> org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
>     [java]     at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
>     [java]     at 
> org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
>     [java]     at 
> org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)
> =====
>
> In looking at 4.0.7 code, the  RuleBase object in ant task 
> org.drools.contrib.DroolsCompilerAntTask is serialized, but the p1_ = 
> (Package) in.readObject(); in the class org.drools.agent.FileScanner 
> is not.
>
> Any solution around this problem?
>
> Thanks in advance for your professional help.
>
> Regards
> Wilson
>
>
>
> _______________________________________________
> 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