希望有人可以帮助我。因此,我有一些从BPMS从RedHat导入的本地bpmn进程。现在,我尝试执行它们以及一些.drl文件,但两次尝试均未成功。这是我正在尝试的:

     KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
     Resource ruleFile = ResourceFactory.newFileResource("src/main/resources/rules0.drl");
     Resource ruleFile1 = ResourceFactory.newFileResource("src/main/resources/rules0.drl");
     Resource process1 = ResourceFactory.newFileResource("src/main/resources/Process1.bpmn");
     kbuilder.add(ruleFile,ResourceType.DRL);
     kbuilder.add(ruleFile1,ResourceType.DRL);
     kbuilder.add(process1,ResourceType.BPMN2);

     KnowledgeBase kbase = kbuilder.newKnowledgeBase();

     kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());                       StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
     ksession.fireAllRules();
     ksession.startProcess(process1.getSourcePath());


但我也尝试过:

    KieServices kServices = KieServices.Factory.get();
    KieRepository kRepository = kServices.getRepository();
    KieFileSystem kFileSystem = kServices.newKieFileSystem();
     Resource ruleFile = ResourceFactory.newFileResource("src/main/resources/rules0.drl");
    kFileSystem.write(ResourceFactory.newClassPathResource("rules0.drl"));
    KieBuilder kBuilder = kServices.newKieBuilder(kFileSystem);
    kBuilder.add(ruleFile,ResourceType.DRL);
    kBuilder.buildAll();

KieContainer kContainer =
    kServices.newKieContainer(kRepository.getDefaultReleaseId());
    KieBase kBase = kContainer.getKieBase();
    KieSession kisession = kBase.newKieSession();
    int tot = kisession.fireAllRules();

    System.out.println(""+tot);


totalRules为零,并且该规则从未触发过。在这两种情况下,如果我尝试启动进程(且仅在启动时),它将出现:

线程“主”中的异常java.lang.AbstractMethodError:org.jbpm.bpmn2.BPMN2ProcessProviderImpl.configurePackageBuilder(Lorg / kie / internal / builder / KnowledgeBuilder;)V

如果我仅尝试触发规则,则不会发生提示,并且tot为0。规则是仅执行syso的简单规则。我在这里想念什么吗?这些规则位于我的maven项目中的src / main / resources /中。抱歉,这样巨大的帖子!

最佳答案

似乎您根本没有插入任何事实,因此我相信不会触发任何规则,因为基本上没有要评估的事实。
关于启动过程,您的项目中似乎缺少一些依赖项。确保jbpm-bpmn2在应用程序的类路径中

高温超导

10-04 20:39