<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=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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;}
/* 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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Your jar files [the models] need to be in the same drools
package as your DRL file.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>So if in the Guvnor you have:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>com.domain.project.rules<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Business
Rules<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Your
DRL file<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Then you need to have the model in the same package.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>com.domain.project.rules<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Business
Rules<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Your
DRL file<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Models<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Jar
1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Jar
2<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Jar
3<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The objects in each jar don’t have to be in the
com.domain.project.rules package. They can be in any package. You
do need to import the correct objects in your DRL however. The package
you specify in the Guvnor is the package that the individual rules get compiled
into.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<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>Ike Okafo<br>
<b>Sent:</b> Monday, June 28, 2010 4:32 PM<br>
<b>To:</b> rules-users@lists.jboss.org<br>
<b>Subject:</b> [rules-users] Rule Validation/Package Build Error in Guvnor:
ClassNot Found<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p>Hello,<o:p></o:p></p>
<div>
<p class=MsoNormal>I am new to Drools and have written a rule .DRL file which
contains some <br>
helper function imports from other packages, fact objects imports from <br>
other packages and the rules that act on these facts. The file works well <br>
when I call it from my javacode using the rulebase or knowledgebase approach. <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>The drl file itself is in its own package.<o:p></o:p></p>
</div>
<p>I now have a requirement to call the same rules from within Guvnor.<br>
The goal is to enable business users modify these rules through the <br>
Guvnor UI and also take advantage of the disable individual rules <br>
feature within guvnor.<o:p></o:p></p>
<div>
<p class=MsoNormal>My current difficulty is importing and validating the rules
in guvnor, <br>
along with the associated fact jar files and finally interfacing <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>with guvnor from my code. Any help would be appreciated .<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>The main error happens when I try to build a binary package
and create<br>
a snapshot of the working rule file I imported for deployment.<br>
When I hit the save and validate configuration button, I get<br>
<strong>"class not found"</strong> validation errors for all the
classes imported at <br>
the top of the rule file - includingng the helper import functions<br>
and facts used in the rules. Same thing happens when I try to <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>build the package I get the following errors <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>"Error importing: <list of all classes in import
statement in rule file>"<o:p></o:p></p>
</div>
<p>Here are the steps I followed in importing the rule file and Jar file
containing the classes<br>
into Guvnor<o:p></o:p></p>
<div>
<p class=MsoNormal>(1) First within Guvnor I created a package corresponding to
the package path<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>for for each of the jar files whose classes are
referenced/imported in the rule .DRL file<o:p></o:p></p>
</div>
<p>(2) I created the jar files for each of these packages in eclipse<o:p></o:p></p>
<p>(3) Imported those jars individually into each of the packages created in
guvnor <br>
using upload model jar function and selecting the
appropriate path as<br>
created in step 1 2 above<o:p></o:p></p>
<p>(4) Imported the rule file which is in its own package - using the create
package (upload method)<o:p></o:p></p>
<p>(5) I then try to save and validate the imported rule file in step
5 (this is where the error occurs)<o:p></o:p></p>
<p><br>
I have already setup my code to call guvnor as follows<o:p></o:p></p>
<p>RuleAgent agent = RuleAgent.newRuleAgent("guvnor.properties");<br>
RuleBase masterRuleBase = agent.getRuleBase();<o:p></o:p></p>
<p>guvnor.properties contains only one entry<br>
url = <a
href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/SomePackage.drools/LATEST">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/SomePackage.drools/LATEST</a><o:p></o:p></p>
<p>It is my understanding that after I import the rule file<br>
I need to save and validate and build the package<br>
in order to point the url to the path above. If I point the url to just<br>
the drl file itself will it work?<br>
i.e url=<a
href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/SomePackage.drools/LATEST.drl">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/SomePackage.drools/LATEST.drl</a>
<br>
<o:p></o:p></p>
<p>Any help to resolve the class not found error will <br>
be much appreciated<o:p></o:p></p>
<p>Thanks<o:p></o:p></p>
</div>
</body>
</html>