[rules-users] reloadKnowledgeBase java.lang.NullPointerException

ayonchak ayon.chakraborty at genworth.com
Tue Aug 30 05:32:14 EDT 2011


Hi All,

I am getting Nullpointer exception the application is trying to
reloadKnwledgeBase. I have the following code in application.

public void init() {
		logger.info("Group Rule Engine Initiated..!!");
		/**
		 * Polling interval needs to be externalized
		 */
		 
		knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent("FiveSeries");
		knowledgeAgent.applyChangeSet(ResourceFactory
				.newFileResource(propertyReader
						.getProperty("DROOLS_GUVNOR_CHAGNE_SET_XML_PATH")));
		
		ResourceFactory.getResourceChangeScannerService().start();
		ResourceFactory.getResourceChangeNotifierService().start();
		
		if (knowledgeAgent != null && knowledgeAgent.getKnowledgeBase()!=null &&
!knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) {
			knowledgeBase = knowledgeAgent.getKnowledgeBase();
		}
		logger.info("Group Rule Engine is ready to use..!!");
	}

	public void reloadKnowledgeBase() {
		if (knowledgeAgent != null && knowledgeAgent.getKnowledgeBase()!=null &&
!knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) {
			knowledgeBase = knowledgeAgent.getKnowledgeBase();
			logger.debug("KnowledgeBase reloaded..!!");
		} else {
			logger.info("KnowledgeBase not reloaded..!!");
			ResourceFactory.getResourceChangeScannerService().stop();
			ResourceFactory.getResourceChangeNotifierService().stop();
			init();			
		}
	}

reloadKnowledgeBase() is called once in application during Login. The
problem is occurring in Development application. When I am using that
Change-Set.xml in my local application, it is working perfectly fine. I m
not getting the problem. I bounced both Jboss and application servers but
still no luck! 

--
View this message in context: http://drools.46999.n3.nabble.com/reloadKnowledgeBase-java-lang-NullPointerException-tp3295019p3295019.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list