Integrating Drools with a pre-existing eclipse project

我们两清 提交于 2019-12-11 06:24:44

问题


This is my first time using Drools and am looking to integrate it with a pre-existing eclipse project. I am using the Drools eclipse plugin. I can successfully create a Drools project and run it without error. However, when I try and use Drools in a normal Java project (the project that existed before I had installed the Drools plugin) I receive a NullPointerException and debugging shows that my KieSession is null:

KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules");
//kSession is null

I have tried to recreate the directories as best as I can (a resources folder and a main folder) and have modified the package names where I can. I suspect that something has gone wrong with creating the directories and files and they cant be found when the KieSession is initialized.

Unfortunately all I can find are related to creating a new Drools project, nothing to do with adding Drools to an existing project. What steps do I need to take to do this? Is there a way I can automatically add the files/packages/directories needed without effecting my current project?

来源:https://stackoverflow.com/questions/39743210/integrating-drools-with-a-pre-existing-eclipse-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!