0 Replies Latest reply on Aug 2, 2013 1:22 AM by Chandra Shekhar

    Null pointer exception KnowledgeAgentFactory.newKnowledgeAgentConfiguration()

    Chandra Shekhar Newbie

      Hi there,

       

      I am using Guvnor 5.3.0 war and drools 6.0.0.Beta5 in JBOSS 7. I deployed succesfully I can able to navigate to create business rule from Guvnor screen but I am getting nullpointer exception during invoke   KnowledgeAgentFactory.newKnowledgeAgentConfiguration(). Please help me here.

       

      Guvnor 5.3.0 is deployed in server. drools 6.0.0 is configured in my workspace.

       

       

      Code: 

       

      import org.kie.internal.KnowledgeBase;

      import org.kie.internal.KnowledgeBaseFactory;

      import org.kie.internal.agent.KnowledgeAgent;

      import org.kie.internal.agent.KnowledgeAgentConfiguration;

      import org.kie.internal.agent.KnowledgeAgentFactory;

      import org.kie.internal.io.ResourceFactory;

      import org.kie.internal.runtime.StatefulKnowledgeSession;

       

       

       

       

       

      private static KnowledgeBase createKnowledgeBase() {
             
              KnowledgeAgentConfiguration kaconf =
                  KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
              // Do not scan directories, just files.
              kaconf.setProperty( "drools.agent.scanDirectories", "false" );
              KnowledgeAgent kagent =
                  KnowledgeAgentFactory.newKnowledgeAgent("test agent", kaconf );
              kagent.applyChangeSet( ResourceFactory.newClassPathResource("guvnor-jboss.xml"));
              return kagent.getKnowledgeBase();
           

          }

       

      I can see newKnowledgeBase() setting properties by defult if input parameters are not passed. I feel something need to be configured enviorment.

       

       

      ---------------------------------

              setProperty( MonitorChangesetEventsOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( MonitorChangesetEventsOption.PROPERTY_NAME,
                                                               "true" ) );

              setProperty( ScanDirectoriesOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( ScanDirectoriesOption.PROPERTY_NAME,
                                                               "true" ) );

              setProperty( ScanResourcesOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( ScanResourcesOption.PROPERTY_NAME,
                                                               "true" ) );

              setProperty( NewInstanceOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( NewInstanceOption.PROPERTY_NAME,
                                                               "true" ) );

              setProperty( UseKnowledgeBaseClassloaderOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( UseKnowledgeBaseClassloaderOption.PROPERTY_NAME,
                                                               "false" ) );

              setProperty( ValidationTimeoutOption.PROPERTY_NAME,
                           this.chainedProperties.getProperty( ValidationTimeoutOption.PROPERTY_NAME,
                                                               "0" ) );