Are you including drools-compiler as a dependency?

On Tue, Jun 15, 2010 at 5:28 PM, Fnu Mahalakshmi <> wrote:

I was trying to use knowledge builder package for dynamic loading of the rule files. Getting major errors.

My knowledge builder basically adds the rule resources from the change-set.xml file which I have in my project directory.

I am using the knowledge agent and knowledge base to add all the packages loaded from my change-set xml file.

Am I wrong somewhere???

My code is as follows:

   private KnowledgeBase loadRules(String[]  rules) throws Exception{

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
         kbuilder.add( ResourceFactory.newClassPathResource( "/change-set.xml", getClass() ),
                       ResourceType.CHANGE_SET );
         if ( kbuilder.hasErrors() ) {
             System.err.println( kbuilder.getErrors().toString() );
         KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
         kagent.applyChangeSet( ResourceFactory.newClassPathResource("/change-set.xml", getClass()));
         KnowledgeBase kbase = kagent.getKnowledgeBase();

         return kbase;

my change-set.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns=''
            xs:schemaLocation='drools-change-set-5.0.xsd' >
      <resource source='src/main/rules/' type='DRL' />

I am getting the following error stack when I run:

Exception in thread "main" org.drools.ProviderInitializationException: Provider org.drools.builder.impl.KnowledgeBuilderProviderImpl could not be set.
       at org.drools.builder.KnowledgeBuilderFactory.loadProvider(
       at org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderProvider(
       at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(
Caused by: java.lang.ClassNotFoundException: org.drools.builder.impl.KnowledgeBuilderProviderImpl
       at$ Source)
       at Method)
       at Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Unknown Source)
       at org.drools.builder.KnowledgeBuilderFactory.loadProvider(
       ... 5 more

The error comes exactly at the start where I call knowledge builder.
Please help!!


Please consider the environment before printing this email.

Visit our website at


Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.

rules-users mailing list


Esteban Aliverti