[rules-users] Getting Null pointer exception for applying change set
Michael Anstis
michael.anstis at gmail.com
Tue Aug 14 11:19:58 EDT 2012
Any particular place you get the NPE?
Is variable "url" null?
On 14 August 2012 16:18, Rana <ven12344 at yahoo.com> wrote:
> Having trouble getting the URL, getting null when getting the ChangeSet
> file.
> Please let me know what is the problem.
>
>
> ResourceChangeScannerConfiguration conf =
>
> ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
> conf.setProperty("drools.resource.scanner.interval", "60");
> log.info("Drools Resource Scanner is set to 60 seconds");
>
> ResourceFactory.getResourceChangeScannerService().configure(conf);
> ResourceFactory.getResourceChangeScannerService().start();
> log.info("Drools Resource Change Scanner Service has
> started");
> ResourceFactory.getResourceChangeNotifierService().start();
> log.info("Drools Resource Change Notifier Service has
> started");
>
> URL url =
> this.getClass().getResource("/src/main/resources/DroolsChangeSet.xml");
> URLClassLoader customURLClassloader = new
> URLClassLoader(new URL[]
> {url }, this.getClass().getClassLoader());
> KnowledgeBuilderConfiguration kbuilderConfig =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
> customURLClassloader);
> // KnowledgeBuilder kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConfig);
> KnowledgeBaseConfiguration kbaseConfig =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
> customURLClassloader);
> kbaseConfig.setOption( EventProcessingOption.STREAM );
> kbaseConfig.setOption( MultithreadEvaluationOption.YES );
> // kbaseConfig.setOption( MaxThreadsOption.get(2) );
> kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
>
> // create a knowledge agent
> KnowledgeAgentConfiguration aconf =
> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
> aconf.setProperty("drools.agent.scanDirectories", "true");
> aconf.setProperty("drools.agent.newInstance", "false");
> // KnowledgeAgent kAgent =
> KnowledgeAgentFactory.newKnowledgeAgent("Drools Knowledge Agent", null,
> aconf);
> KnowledgeAgent kagent =
> KnowledgeAgentFactory.newKnowledgeAgent("Drools Knowledge Agent", kbase,
> aconf, kbuilderConfig);
> kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
> log.info("Knowledge Agent Created for all the Drools
> Files");
>
> // load up the knowledge base
> kbase = kagent.getKnowledgeBase();
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Getting-Null-pointer-exception-for-applying-change-set-tp4019117.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120814/51555733/attachment.html
More information about the rules-users
mailing list