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
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";
---------------------------------