I'm having a problem connecting my KnowledgeAgent to a package in Guvnor. I'm using Spring to instantiate the KnowledgeAgent. The agent initializes perfectly well when I point to a local change-set that in-turn points to a local rule. However, even though I have the same rule in a package in Guvnor, the KnowledgeAgent fails with the following exception when I point to the package's change-set in Guvnor:
java.lang.NullPointerException
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:148)
at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1016)
at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:785)
at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:657)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190)
at org.drools.container.spring.beans.KnowledgeAgentBeanFactory.afterPropertiesSet(KnowledgeAgentBeanFactory.java:91)
...
The code at KnowledgeBaseImpl.java:148 is (using 5.3.0.Final):
public void addKnowledgePackages(Collection<KnowledgePackage> knowledgePackages) {
List<Package> list = new ArrayList<Package>();
for ( KnowledgePackage knowledgePackage : knowledgePackages ) {
list.add( ((KnowledgePackageImp) knowledgePackage).pkg ); //148
}
((ReteooRuleBase)ruleBase).addPackages( list);
}
Here is the simple rule in the Guvnor as returned by the URL for the package source URL:
package Survey
declare TestTest
jojo: String
end
rule "CompleteSurvey"
dialect "mvel"
no-loop
when
Object()
then
System.out.println("\r\nCOMPLETESURVEY FIRED!!\r\n");
end
Here is the local change-set definition. The line that is commented is the failing resource, whereas the local file resource works fine:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
<add>
<resource source='file:c:/etc/drools/Test.drl' type='DRL' />
<!-- <resource source='http://myTCServer:8080/guvnor-5.2.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/package/Survey/LATEST/ChangeSet.xml' type='PKG' />-->
</add>
</change-set>
Guvnor is residing on a Tomcat server.
I could not find anything related to this on the forum. Thank you for any hints.
-Paul