Note that there are some explanatory texts on larger screens.

plurals
  1. PODrools REST CannotResolveClassException
    text
    copied!<p>Using Drools 5.5.0.Final with Guvnor 5.5.0.Final with the sample mortgages package.</p> <p>When submitting REST json request with the following Batch Execution Command:</p> <pre><code>{ "batch-execution": { "lookup":"ksession1", "commands":[ { "insert":{ "out-identifier":"outApplicant", "return-object":"true", "object": { "Applicant":{ "age":17 } } } }, { "fire-all-rules":"" } ] } } </code></pre> <p>returns: 500 Internal Server Error</p> <pre><code>com.thoughtworks.xstream.converters.ConversionException: Applicant : Applicant ---- Debugging information ---- message : Applicant cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : Applicant class : org.drools.command.runtime.rule.InsertObjectCommand required-type : org.drools.command.runtime.rule.InsertObjectCommand converter-type : org.drools.runtime.help.impl.XStreamJson$JsonInsertConverter line number : -1 class[1] : org.drools.command.runtime.BatchExecutionCommandImpl converter-type[1] : org.drools.runtime.help..XSt...$JsonBatchExecutionCommandConverter version : null </code></pre> <p>The Applicant class is defined in the mortgages package within an XSD like so:</p> <pre><code>age:Whole number (integer) applicationDate:Date creditRating:Text name:Text approved:True or False </code></pre> <p><strong>How can I tell drools where to find the Applicant class?</strong> ( <em>which is defined in the mortgage sample as an XSD file</em>) </p> <p>knowledge-services.xml currently looks like this:</p> <pre><code>&lt;drools:grid-node id="node1"/&gt; &lt;drools:kbase id="kbase1" node="node1"&gt; &lt;drools:resources&gt; &lt;drools:resource type="PKG" source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/packages/mortgages"/&gt; &lt;/drools:resources&gt; &lt;/drools:kbase&gt; </code></pre> <p>I suspect that changing the REST json request to fully specify the package name for Applicant class might work. </p> <pre><code> ... "object": { "something.somethingelse.Applicant":{ "age":17 } } ... </code></pre> <p>But can't seem to find where the fully qualified package name for Applicant is declared? </p> <p>Acceptable answer must show an example which works without having to write java code, since the whole point of the REST interface is to access drools through a web service interface. </p> <p>Is there a spring configuration , or some other way to write the json request that will work?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload