<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<HEAD><!-- Template generated by Exclaimer Template Editor on 07:08:42 Wednesday, 30 January 2013 -->
<STYLE type=text/css>P.52562654-851b-4305-a1a1-b72e8dd7fb7d {
        MARGIN: 0cm 0cm 0pt
}
LI.52562654-851b-4305-a1a1-b72e8dd7fb7d {
        MARGIN: 0cm 0cm 0pt
}
DIV.52562654-851b-4305-a1a1-b72e8dd7fb7d {
        MARGIN: 0cm 0cm 0pt
}
TABLE.52562654-851b-4305-a1a1-b72e8dd7fb7dTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="Generator" content="Microsoft Word 12 (filtered medium)" />
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:366836471;
        mso-list-type:hybrid;
        mso-list-template-ids:-1609259268 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level2
        {mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level4
        {mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level7
        {mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1
        {mso-list-id:519396972;
        mso-list-type:hybrid;
        mso-list-template-ids:1747774160 278925326 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:SimSun;
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level3
        {mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level4
        {mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level5
        {mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level6
        {mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level7
        {mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level8
        {mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level9
        {mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2
        {mso-list-id:889923728;
        mso-list-type:hybrid;
        mso-list-template-ids:-316789820 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l2:level2
        {mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level3
        {mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level4
        {mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level5
        {mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level6
        {mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level7
        {mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level8
        {mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level9
        {mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</HEAD>
<BODY lang="EN-US" link="blue" vlink="purple">
<P>
<div class="WordSection1">
<p class="MsoNormal"><span style=color:#1F497D>Hi rules users,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D>I am having a problem with Drools 5.1.1 recently. The exception we had is:<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0><o:p> </o:p></span></p>
<p class="MsoNormal"><b><u><span style=color:#0070C0>java.lang.ClassCastException:
<o:p></o:p></span></u></b></p>
<p class="MsoNormal"><b><u><span style=color:#0070C0>d2.rules.state.</span>EvaluateRule<span style=color:#0070C0> cannot be cast to d2.autorating.data.model.</span>Account<span style=color:#0070C0><o:p></o:p></span></u></b></p>
<p class="MsoNormal"><span style=color:#0070C0>org.drools.runtime.rule.ConsequenceException: rule:
<u>DERIVE_COLLAT_MECHANISM_PLEDGE</u> <o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D>Our rules are listed as below:<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>rule "DERIVE_COLLAT_MECHANISM_PLEDGE"<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>no-loop true<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>salience 19991<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> when <o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $RatingData : RatingRuleFact()<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $contract : Contract()
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $csaDoc : Document(documentId == $contract.csaId && status == "Final/Signed")<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> (EvaluateRule(ruleName == "INSCOPE))
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> then<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> RuleProcessingOutput ruleOutput = $RatingData.getRuleOutput();<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> RuleResult result = new RuleResult(drools.getRule().getName(), $contract.getContractId(), $RatingData.getPrincipalPartyCountry());<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> ruleOutput.addRuleResult(result);<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $contract.setCollateralMechanism(result.getRuleOutputText());<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> insertLogical(new EvaluateRule(drools.getRule().getName()));<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>end<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>rule "EXC_COLLAT_HOLDING_ARRANGEMENT"<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>no-loop true<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>salience 19985<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> when <o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $RatingData : RatingRuleFact()<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $contract : Contract()
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> $noHoldingAgreementAccts : ArrayList()<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> from collect ( Account(collatNetId == $contract.contractId,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> businessUnit not in ("COMM", "FID", "FX", "IED", "SECLENDING", "SWAPS")) from $contract.collatAccounts<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> ) <o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> EvaluateRule(ruleName == "INSCOPE")
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> then<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> RuleProcessingOutput ruleOutput = $RatingData.getRuleOutput();<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> for (Object obj : $noHoldingAgreementAccts) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> Account acct = (Account) obj;<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> if (acct.getDp2Account() != null) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> RuleResult result = new RuleResult(drools.getRule().getName(), $contract.getContractId(), $RatingData.getPrincipalPartyCountry());<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> result.setAccountId(acct.getDp2Account().getAccountId());
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> result.setRuleOutputText("BU has no Data");<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> ruleOutput.addRuleResult(result);<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> if ($noHoldingAgreementAccts.size() > 0) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> insertLogical(new EvaluateRule(drools.getRule().getName()));<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>end<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#0070C0>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l2 level1 lfo1"><![if !supportLists]><span style=font-family:Symbol;color:#1F497D><span style=mso-list:Ignore>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>In object </span><span style=color:#0070C0>Account()</span><span style=color:#1F497D>, we did not have any EvaluateRule() object in it.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style=font-family:Symbol;color:#1F497D><span style=mso-list:Ignore>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>We also noticed after the "from collect" key word there are EvaluateRule() object defined after it(but the purpose is just to determine if this object exist or not in the Working Memory), in the LHS
of each rule file. <o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style=font-family:Symbol;color:#1F497D><span style=mso-list:Ignore>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>In the variable </span>
<span style=color:#0070C0>$noHoldingAgreementAccts</span><span style=color:#1F497D>, we are not supposed to see the object –
</span><b><u>EvaluateRule </u></b><span style=color:#1F497D>(BUT the exception is showing it is trying to cast
</span><b><u>EvaluateRule</u></b><span style=color:#1F497D> into </span><b><u>Account</u></b><span style=color:#1F497D>)
<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D>My question is are there any known problems/issues with the following<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo3"><![if !supportLists]><span style=color:#1F497D><span style=mso-list:Ignore>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>Drools rule compilers <o:p>
</o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo3"><![if !supportLists]><span style=color:#1F497D><span style=mso-list:Ignore>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>Key word from collect<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo3"><![if !supportLists]><span style=color:#1F497D><span style=mso-list:Ignore>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>Rules production memory<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo3"><![if !supportLists]><span style=color:#1F497D><span style=mso-list:Ignore>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style=color:#1F497D>Version 5.1.1<o:p></o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=color:#1F497D>that can make this happen? Any ideas will be appreciated. Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style=font-size:9.0pt;font-family:"Arial","sans-serif";color:black>Kevin Tan</span><span style=font-size:10.0pt;font-family:"Arial","sans-serif";color:black><br />
</span><b><span style=font-size:7.5pt;font-family:"Arial","sans-serif";color:black>Morgan Stanley | Enterprise Data & Services<br />
</span></b><span style=font-size:7.5pt;font-family:"Arial","sans-serif";color:black>700 Rue Wellington | Floor 04 <br />
Montreal, QC H3C 3S4 <br />
Phone: +1 514 876-5756 <br />
<a href="mailto:Thanh.Dang@morganstanley.com"><span style=color:blue>Kevin.Tan@morganstanley.com</span></a> </span><span style=color:#1F497D><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<BR /><BR />
<HR id=HR1 />
<BR /><SPAN style="FONT-FAMILY: Arial; COLOR: #808080; FONT-SIZE: 7.5pt">NOTICE:
Morgan Stanley is not acting as a municipal advisor and the opinions or views
contained herein are not intended to be, and do not constitute, advice within
the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer
Protection Act. If you have received this communication in error, please destroy
all electronic and paper copies and notify the sender immediately.
Mistransmission is not intended to waive confidentiality or privilege. Morgan
Stanley reserves the right, to the extent permitted under applicable law, to
monitor electronic communications. This message is subject to terms available at
the following link: <A style="FONT-FAMILY: Arial; COLOR: #808080; FONT-SIZE: 7.5pt" href="http://www.morganstanley.com/disclaimers">http://www.morganstanley.com/disclaimers</A>
If you cannot access these links, please notify us by reply message and we will
send the contents to you. By messaging with Morgan Stanley you consent to the
foregoing.</SPAN><BR />
<P></P>
<P></P></P></BODY>
</HTML>