<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><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Bookman Old Style";
        panose-1:2 5 6 4 5 5 5 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Bookman Old Style","serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>I also was getting this error. I brought out package building logic to execute once, and KnowledgeSession related logic to repeat the required number of times. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>Seems there required some delay in preparing rules related classes into one package during iteration and loading the same. Above step was working fine for me.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>Pseudo code:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>KnowledgeBuilder </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbuilder</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = KnowledgeBuilderFactory.<i>newKnowledgeBuilder</i>();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// this will parse and compile in one step</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// get the compiled packages (which are serializable)</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Collection&lt;KnowledgePackage&gt; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>pkgs</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// add the packages to a knowledgebase (deploy the knowledge packages).</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KnowledgeBase </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbase</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StatefulKnowledgeSession </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // constructor to be called once<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in;text-autospace:none'><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>public</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> RuleEngine (</span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>byte</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'>[] rules) {</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbuilder</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.add(ResourceFactory.<i>newByteArrayResource</i>(rules),ResourceType.</span><i><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>DRL</span></i><span style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Check the builder for errors</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>if</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> (</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbuilder</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.hasErrors()) {</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>out</span></i><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.println(</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbuilder</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.getErrors().toString());</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>throw</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> RuntimeException(</span><span style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Unable to compile drl.&quot;</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>pkgs</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbuilder</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.getKnowledgePackages();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// add the packages to a knowledgebase (deploy the knowledge packages).</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbase</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = KnowledgeBaseFactory.<i>newKnowledgeBase</i>();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbase</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.addKnowledgePackages(</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>pkgs</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>// this method will be called required number of times</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>public</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>void</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> fire(Object obj) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> = </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>kbase</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.<span style='background:silver;mso-highlight:silver'>newStatefulKnowledgeSession</span>();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.addEventListener(</span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> DebugAgendaEventListener());</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.addEventListener(</span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:"Courier New";color:black'> DebugWorkingMemoryEventListener());</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// setup the audit logging</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>//KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, &quot;log/drools.log&quot;);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.insert(obj);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.fireAllRules();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>//logger.close();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>ksession</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>.dispose();</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>Check this out.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>Thanks &amp; Regards<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'>Santhosh Pallerla<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Bookman Old Style","serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <b>On Behalf Of </b>nicolas<br><b>Sent:</b> Thursday, September 29, 2011 8:09 AM<br><b>To:</b> rules-users@lists.jboss.org<br><b>Subject:</b> [rules-users] Concurrency problem in PackageClassLoader<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Hi,<br><br>We are using a single (Drools 5.1.1) Stateless Sessions for the parallel processing of thousands of facts.<br><br>&gt;From time to time we experienced the following error :<br><br>org.drools.runtime.rule.ConsequenceException: rule: Priorite - Groupe: TMK2612G01, P10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at acme.srv.ept.service.impl.traitement.MoteurTraitementDemandes.traiterDemande(MoteurTraitementDemandes.java:121)<br>(...)<br><b>Caused by: java.util.ConcurrentModificationException</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap$AbstractMapIterator.checkConcurrentMod(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap$AbstractMapIterator.makeNext(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap$KeyIterator.next(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap.analyzeMap(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap.rehash(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap.rehash(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap.putImpl(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.HashMap.put(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.loadClass(JavaDialectRuntimeData.java:503)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>at java.lang.ClassLoader.loadClass(ClassLoader.java:609)</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at&nbsp; acme.srv.ept.regle.Rule_Priorite___Groupe__TMK2612G01__P10_0DefaultConsequenceInvoker.evaluate(Rule_Priorite___Groupe__TMK2612G01__P10_0DefaultConsequenceInvoker.java:29)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... 49 more<br><br>We get the same error when we used a pool of Stateless Sessions (serial access) based on the same KnowledgeBase for the processing.<br><br><br>Thanks,<o:p></o:p></p></div></body></html>