Hello,
 
remove the final modifier for the getHomePage method, it's a problem related to shadowProxies, as they are CGLIB proxies they cannot proxy final methods...
 
-Patrick
-----Message d'origine-----
De : rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]De la part de Benoit VILLAUMIE
Envoyé : mercredi, 20. août 2008 16:38
À : rules-users@lists.jboss.org
Objet : [rules-users] Drools 4.0.7 - Rules not fired

Hello,

I am using Drools engine 4.0.7 and Eclipse 3.3 drools plugin.

I have a very basic/dumb problem but I do not understand where my error is :

I have 2 rules
---------------------------------
package poc

import poc.FlashFact;

rule "HP one"
    when
        FlashFact( homepage == "one");
    then
        System.out.println("*** HP one");
end

rule "HP commons"
    when
        FlashFact();
    then
        System.out.println("*** HP commons ");
end
----------------------------------

I insert a FlashFact which homepage is set with "one" value.

In my understanding, both rules "HP one" and "HP commons" should be fired. Instead, only "HP commons" is launched. I have compared with the Drools State example (which works fine), but I do not notice nothing.

Thanks for your help.

The code of the FlashFact class
---------------------------------
package poc;

public class FlashFact {
   
    public FlashFact() {
        this(null);
    }
   
    public FlashFact(String homepage) {
        this.setHomepage(homepage);
    }   
   
    private String homepage;

    /**
     * @return the homepage
     */
    public final String getHomepage() {
        return this.homepage;
    }

    /**
     * @param homepage the homepage to set
     */
    public final void setHomepage(String homepage) {
        this.homepage = homepage;
    }

}
---------------------------------

The code of the launcher
---------------------------------
package poc;

import java.io.InputStreamReader;

import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.compiler.PackageBuilder;

public class FlashUndeployedRulesMain {

    public static void main(String[] args) throws Exception {
        StatefulSession session = null;
        WorkingMemoryFileLogger logger = null;
        try {
            PackageBuilder builder = new PackageBuilder();
            builder.addPackageFromDrl(new InputStreamReader(
                    FlashUndeployedRulesMain.class.getClassLoader()
                            .getResourceAsStream(RULE)));
            final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
            ruleBase.addPackage(builder.getPackage());
            session = ruleBase.newStatefulSession();
           
            logger = new WorkingMemoryFileLogger(
                    session);
            logger.setFileName("log/flash");
           
            // inserting facts
            FlashFact HPFrance = new FlashFact("one");
           
            session.insert(HPFrance);
           
            session.fireAllRules();
        } finally {
            if(session != null) {session.dispose();}
            if(logger != null) {logger.writeToDisk();}
        }
    }

    private static final String RULE = "poc/Flash.drl";
---------------------------------