[rules-users] Problem Setting globals in drools session

djerir smail 1983djerir at gmail.com
Mon Jul 5 15:38:51 EDT 2010


Hello everybody,

When I try to sett my globals  I get this error

2010-07-05 21:26:04,531 ERROR [STDERR] java.lang.RuntimeException: 
Illegal class for global. Expected [ulb.mfe.srabre.ra.BREINTERFACE], 
found [ulb.mfe.srabre.ra.BREINTERFACE].

Can anyone explain to me what does this error mean please .

MY DRL FILE

package ulb.mfe.srabre.rule

import ulb.mfe.srabre.ra.BREINTERFACE;
import ulb.mfe.srabre.ra.DROOLSSLEEAgent;

global ulb.mfe.srabre.ra.BREINTERFACE BRERAInterface;
global ulb.mfe.srabre.ra.DROOLSSLEEAgent DROOLSSLEEAgent;

rule "MaxBtsAlarmrule"
dialect "mvel"

when

 $B : BREINTERFACE()
then
    System.out.println(" HELLO ");
end




my code


public void Insert(Object fact) {
    try{   
        KnowledgeSessionConfiguration sessConfig = 
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
        sessConfig.setOption(ClockTypeOption.get("pseudo"));
        StatefulKnowledgeSession session = 
knowledgeBase.newStatefulKnowledgeSession();
        session.setGlobal("BRERAInterface", this.breinter);
        session.setGlobal("DROOLSSLEEAgent", this.droolssleeAgent);
        session.insert(this.breinter);
        System.out.println("Fact is now inserted");
        session.fireAllRules();
    } catch (Throwable t) {
        logger.info("sml couldn't set up a session");
        t.printStackTrace();
    }
    }



More information about the rules-users mailing list