<br>   Kris just reminded me of something: do you have the actual Message class in the test program classpath? <br><br>   When downloading the package from guvnor, I think it does not download the model jar... only the actual rules, etc...<br>
<br>   Edson<br><br><div class="gmail_quote">2009/11/25 richarda <span dir="ltr">&lt;<a href="mailto:richard.ambridge@gmail.com">richard.ambridge@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Also tried under 5.1.0M1 release.. same issue :(<br>
Am i doing something wrong by declaring the @role in the Configuration<br>
section?<br>
<div><div></div><div class="h5"><br>
<br>
richarda wrote:<br>
&gt;<br>
&gt; Still trying to get this to work.<br>
&gt; I have managed to create from a default (new) guvnor setup.<br>
&gt;<br>
&gt; Steps I do..<br>
&gt; 1. Create fresh guvnor<br>
&gt; 2. In eclipse create  Message.java file in package com.sample, and create<br>
&gt; a jar file<br>
&gt; 3. In guvnor import the model for the Message.jar file<br>
&gt; 4. In guvnor create a category<br>
&gt; 5. Create an import statement for  import com.sample.Message<br>
&gt; 6. Create a simple technical rule,  something like   when, Message(),<br>
&gt; then, System.out.println(&quot;.&quot;);<br>
&gt; 7. Build the pkg<br>
&gt; 8. download the pkg<br>
&gt;<br>
&gt; use the code from previous post to load the pkg...<br>
&gt; it works fine..<br>
&gt;<br>
&gt; now, goto guvnor advanced view and change the Configuration from:<br>
&gt; import com.sample.Message<br>
&gt;<br>
&gt; to:<br>
&gt;<br>
&gt; import com.sample.Message;<br>
&gt;<br>
&gt; declare Message<br>
&gt;   @role( event )<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt; build the pkg,<br>
&gt; download the pkg,<br>
&gt; run the test program...<br>
&gt;<br>
&gt; I get:<br>
&gt; org.drools.RuntimeDroolsException: unable to resolve Type Declaration<br>
&gt; class &#39;Message&#39;<br>
&gt;       at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)<br>
&gt;       at<br>
&gt; org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)<br>
&gt;       at<br>
&gt; org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)<br>
&gt;       at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)<br>
&gt;       at com.sample.DroolsTest.main(DroolsTest.java:27)<br>
&gt;<br>
&gt;<br>
&gt; richarda wrote:<br>
&gt;&gt;<br>
&gt;&gt; So, my code is doing this:<br>
&gt;&gt;<br>
&gt;&gt;  KnowledgeBaseConfiguration conf =<br>
&gt;&gt; KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br>
&gt;&gt;             conf.setOption(EventProcessingOption.STREAM);<br>
&gt;&gt;             KnowledgeBuilder builder =<br>
&gt;&gt; KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
&gt;&gt;             try {<br>
&gt;&gt;                 File f = new File(&quot;/tmp/my.pkg&quot;);<br>
&gt;&gt;                 InputStream stream = new FileInputStream(f);<br>
&gt;&gt;                 if (stream == null) {<br>
&gt;&gt;                     jlog.fatal(&quot;Unable to find rule pkg&quot;);<br>
&gt;&gt;                 } else {<br>
&gt;&gt;                     <a href="http://jlog.info" target="_blank">jlog.info</a>(&quot;adding pkg&quot;);<br>
&gt;&gt;<br>
&gt;&gt; builder.add(ResourceFactory.newInputStreamResource(stream),<br>
&gt;&gt; ResourceType.PKG);<br>
&gt;&gt;                 }<br>
&gt;&gt;             } catch (Exception e) {<br>
&gt;&gt;                 e.printStackTrace();<br>
&gt;&gt;             }<br>
&gt;&gt;             KnowledgeBase kbase =<br>
&gt;&gt; KnowledgeBaseFactory.newKnowledgeBase(conf);<br>
&gt;&gt;             kbase.addKnowledgePackages(builder.getKnowledgePackages());<br>
&gt;&gt;             <a href="http://jlog.info" target="_blank">jlog.info</a>(&quot;setup creating knowledge session&quot;);<br>
&gt;&gt;             ksession = kbase.newStatefulKnowledgeSession();<br>
&gt;&gt;             <a href="http://jlog.info" target="_blank">jlog.info</a>(&quot; setup ksession created&quot;);<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The pkg was created from Guvnor.<br>
&gt;&gt;<br>
&gt;&gt; If in the package declaration area in Guvnor,  (where you put the import<br>
&gt;&gt; statements)<br>
&gt;&gt; If I put<br>
&gt;&gt; declare Signature<br>
&gt;&gt;  @role ( event )<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt; then build the package, save it to disk /tmp/my.pkg<br>
&gt;&gt; on startup I get:<br>
&gt;&gt;<br>
&gt;&gt; [#|2009-11-24T14:50:38.944+0000|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:<br>

&gt;&gt; unable to resolve Type Declaration class &#39;Signature&#39;<br>
&gt;&gt;      at<br>
&gt;&gt; org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)<br>
&gt;&gt;      at<br>
&gt;&gt; org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)<br>
&gt;&gt;      at<br>
&gt;&gt; org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I need to declare &#39;Signature&#39; as an &#39;event&#39;<br>
&gt;&gt; Am I doing this wrong?<br>
&gt;&gt;<br>
&gt;&gt; If I do this all in Eclipse and load the DRL files manually it all works.<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html" target="_blank">http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html</a><br>

<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>