<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1491" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><SPAN class=961564011-01052009><FONT face=Arial color=#0000ff
size=2>Hello,</FONT></SPAN></DIV>
<DIV><SPAN class=961564011-01052009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=961564011-01052009><FONT face=Arial color=#0000ff size=2>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...</FONT></SPAN></DIV>
<DIV><SPAN class=961564011-01052009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=961564011-01052009><FONT face=Arial color=#0000ff
size=2>-Patrick</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Message d'origine-----<BR><B>De :</B>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org]<B>De la part de</B> Benoit
VILLAUMIE<BR><B>Envoyé :</B> mercredi, 20. août 2008
16:38<BR><B>À :</B> rules-users@lists.jboss.org<BR><B>Objet :</B>
[rules-users] Drools 4.0.7 - Rules not
fired<BR><BR></FONT></DIV>Hello,<BR><BR>I am using Drools engine 4.0.7 and
Eclipse 3.3 drools plugin.<BR><BR>I have a very basic/dumb problem but I do
not understand where my error is :<BR><BR>I have 2 rules
<BR>---------------------------------<BR>
<BLOCKQUOTE>package poc<BR><BR>import poc.FlashFact;<BR><BR><B>rule "HP
one"</B><BR> when<BR>
FlashFact( homepage == "one");<BR>
then<BR> System.out.println("*** HP
one");<BR>end<BR><BR><B>rule "HP commons"</B><BR>
when<BR>
FlashFact();<BR> then<BR>
System.out.println("*** HP commons
");<BR>end<BR></BLOCKQUOTE>----------------------------------<BR><BR>I insert
a FlashFact which homepage is set with "one" value.<BR><BR>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.<BR><BR>Thanks for your
help.<BR><BR>The code of the FlashFact
class<BR>---------------------------------<BR>
<BLOCKQUOTE>package poc;<BR><BR>public class FlashFact
{<BR> <BR> public FlashFact()
{<BR> this(null);<BR>
}<BR> <BR> public FlashFact(String
homepage) {<BR>
this.setHomepage(homepage);<BR> }
<BR> <BR> private String
homepage;<BR><BR> /**<BR> *
@return the homepage<BR> */<BR>
public final String getHomepage() {<BR>
return this.homepage;<BR> }<BR><BR>
/**<BR> * @param homepage the homepage to
set<BR> */<BR> public final void
setHomepage(String homepage) {<BR>
this.homepage = homepage;<BR>
}<BR><BR>}<BR></BLOCKQUOTE>---------------------------------<BR><BR>The code
of the launcher<BR>---------------------------------<BR>package
poc;<BR><BR>import java.io.InputStreamReader;<BR><BR>import
org.drools.RuleBase;<BR>import org.drools.RuleBaseFactory;<BR>import
org.drools.StatefulSession;<BR>import
org.drools.audit.WorkingMemoryFileLogger;<BR>import
org.drools.compiler.PackageBuilder;<BR><BR>public class
FlashUndeployedRulesMain {<BR><BR> public static void
main(String[] args) throws Exception {<BR>
StatefulSession session = null;<BR>
WorkingMemoryFileLogger logger =
null;<BR> try {<BR>
PackageBuilder builder = new
PackageBuilder();<BR>
builder.addPackageFromDrl(new InputStreamReader(<BR>
FlashUndeployedRulesMain.class.getClassLoader()<BR>
.getResourceAsStream(RULE)));<BR>
final RuleBase ruleBase =
RuleBaseFactory.newRuleBase();<BR>
ruleBase.addPackage(builder.getPackage());<BR>
session =
ruleBase.newStatefulSession();<BR>
<BR>
logger = new WorkingMemoryFileLogger(<BR>
session);<BR>
logger.setFileName("log/flash");<BR>
<BR>
// inserting facts<BR>
FlashFact HPFrance = new FlashFact("one");
<BR>
<BR>
session.insert(HPFrance);<BR>
<BR>
session.fireAllRules();<BR>
} finally {<BR>
if(session != null)
{session.dispose();}<BR>
if(logger != null)
{logger.writeToDisk();}<BR>
}<BR> }<BR><BR> private static final
String RULE =
"poc/Flash.drl";<BR>---------------------------------<BR><BR><BR></BLOCKQUOTE></BODY></HTML>