Hi Everyone,<br><br>I&#39;m having a problem adding a rule to a custom package. I have a drl file in the com.sample package. I read in that drl file and everything is fine. I then wish to add another rule to the KnowledgeBase as a String. I&#39;m using the following code for this (where kbase is the existing  KnowledgeBase with the preloaded rules):<br>
<br><span style="color: rgb(51, 51, 255);">            KnowledgeBuilder kbuilder2 = KnowledgeBuilderFactory.newKnowledgeBuilder(kbase);</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">            </span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">            String rule = &quot;rule \&quot;GeneralClause-2\&quot; &quot; +</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">            &quot;when &quot; +</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">                &quot;ObligationComplianceEvent(term == \&quot;term2\&quot;, obligation == \&quot;obligation1\&quot;, level == 2) &quot; +</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">            &quot;then &quot; +</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">                &quot;contract.setState(\&quot;Hello\&quot;);&quot; +</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">            &quot;end&quot;;</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">                                  </span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">            Resource ruleResource = ResourceFactory.newReaderResource((Reader) new StringReader(rule));</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">            kbuilder2.add(ruleResource, ResourceType.DRL); </span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">            </span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">            kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages());</span><br><br>
It appears to fails when I call fireUntilHalt() on my session with the following exception:<br><br><span style="color: rgb(51, 102, 255);">Exception in thread &quot;Thread-1&quot; java.lang.NoClassDefFoundError: defaultpkg/Rule_GeneralClause_2_0</span><br>
<br>It appears the new rule was added to the default package, and it relies on events defined in com.sample so I&#39;m assuming this is the problem. My question is how can I add this rule to com.sample along with the previously loaded rules? I&#39;m very desperate here, any help is greatly appreciated!<br>
<br>Cheers,<br><br>Justin<br>