<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Unable to create Field Extractor
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/stellina_rosa">stellina_rosa</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/606688#606688">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><h6>Hi!</h6><h6>I'm trying to create an example Drools file but when I run it I have this error message:</h6><h6></h6><h6></h6><h6><span style="font-family: 'courier new', courier; font-size: 8pt;">Unable to create Field Extractor for 'contenuto' of '[ClassObjectType class="java".lang.Object]' in rule 'prova' : [Rule name='prova']</span></h6><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">java.lang.IllegalArgumentException: Could not parse knowledge.</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:58)</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:43)</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          at com.sample.ProcessTest.main(ProcessTest.java:21)</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h6>this is my drools file (named Rule.drl):</h6><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">package com.googlecode.cursos.jbpm</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">import org.drools.runtime.process.WorkflowProcessInstance;</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">import org.sample.model.MyObject;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">rule "prova"</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          ruleflow-group "regole"</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          when</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                    $o: Object(contenuto == "rosa") </span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          then </span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">           System.out.println("prima regola");</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">end</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h6>this is my ProcessTest.java class:</h6><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">public class ProcessTest {</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          public static final void main(String[] args) {</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                    try {</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              // load up the knowledge base</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              KnowledgeBase kbase = readKnowledgeBase();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              MyObject obj = new MyObject();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              obj.setContenuto("rosa");</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              obj.setId(1);</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              ksession.insert(obj);</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              // start a new process instance</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              ksession.startProcess("com.sample.bpmn.hello");</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              ksession.fireAllRules();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              logger.close();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                    } catch (Throwable t) {</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                              t.printStackTrace();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">                    }</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;"> private static KnowledgeBase readKnowledgeBase() throws Exception {</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">  kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">  kbuilder.add(ResourceFactory.newClassPathResource("Rule.drl"), ResourceType.DRL);</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">  return kbuilder.newKnowledgeBase();</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">  }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h6><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">and this is my MyObject.java class:</span></h6><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 8pt; font-family: 'courier new', courier;">package org.sample.model;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">public class MyObject {</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          String contenuto;</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          int id;</span> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">          public int getId() { </span>return id;<span style="font-family: 'courier new', courier; font-size: 8pt;">}</span></p><p> <span style="font-family: 'courier new', courier; font-size: 8pt;"> public void setId(int id) {</span><span style="font-family: 'courier new', courier; font-size: 8pt;"> this.id = id;</span><span style="font-family: 'courier new', courier; font-size: 8pt;"> }</span> </p><p> <span style="font-family: 'courier new', courier; font-size: 8pt;"> public String getContenuto() {</span><span style="font-family: 'courier new', courier; font-size: 8pt;"> return contenuto;</span><span style="font-family: 'courier new', courier; font-size: 8pt;"> }</span> </p><p> <span style="font-family: 'courier new', courier; font-size: 8pt;"> public void setContenuto(String contenuto) {</span><span style="font-family: 'courier new', courier; font-size: 8pt;"> this.contenuto = contenuto;</span><span style="font-family: 'courier new', courier; font-size: 8pt;">}</span> </p><p><span style="font-family: 'courier new', courier; font-size: 8pt;">}</span></p><p><span style="font-family: 'courier new', courier; font-size: 8pt;"><br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">I can't understand where is the problem <span> :( </span> </span></p><p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">could anyone help me please?</span></p><p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">thank you! </span></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/606688#606688">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>