Drools Server fails starting when reading brl rules from Guvnor

260 Views Asked by At

I'm having trouble with the integration of Drools Camel Server and Guvnor.. Version 5.5.0

I've created a JAR which contains POJO and used it in Guvnor to create a BRL rule (in the future will be created by not technical people)..

The problem is that when I start the drools server , it complains that it cannot find the class Message defined in the Import of the Rules..

Below the configuration of the Knowledge-servics.xml

    <drools:grid-node id="node1" />
    <drools:resource-change-scanner id="res-scanner1" interval="15" enabled="true" />
    <drools:kbase id="kbase1" node="node1" />
    <drools:kagent id="kagent1" kbase="kbase1" new-instance="false">
            <drools:resources>
                    <drools:resource type="PKG" source="http://localhost:8082/guvnor/org.drools.guvnor.Guvnor/package/<mypackage>/LATEST" basic-authentication="enabled" username="admin" 
                            password="admin" /> 
            </drools:resources>
    </drools:kagent>
    <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1" />

This is my rule in Guvnor

package mypackage 

import mypackage.model.Message 
rule "first" 
dialect "mvel" 
when 
   Message( text == "a" ) 
then 
   Message fact0 = new Message(); 
   fact0.setText( "b" ); 
   insert( fact0 ); 
end 
1

There are 1 best solutions below

1
On

The binary package doesn't contain the java classes. You have 2 options: 1.- Copy your POJO jar in drools-server classpath 2.- You can programatically get the jar from Guvnor (Guvnor exposes it through an url) and add it to your classpath.

Hope it helps,