RuntimeException 试图 运行 Drools 示例

RuntimeException trying to run Drools examples

我下载了 Drools 7.46。0.Final 并将内容提取到我的本地驱动器。当我尝试使用提供的 runExamples.sh 脚本从 Linux 命令行 运行 示例时,出现以下异常。我试过 Java 8 和 Java 11(我安装的唯一版本)。这真的需要 Java 6 就像消息推荐的那样还是这里有其他问题?

我是 Drools 的新手,所以我不确定如何解决这个问题。

更新:有趣的是,我尝试了 7.44 版。0.Final 运行 没问题。所以下载了 7.45.0.Final 那个也坏了。所以在 7.44 和 7.45 之间发生了一些变化,导致了这个。

10:06:44.154 [main] INFO  o.k.a.i.utils.ServiceDiscoveryImpl.processKieService:129 - Cannot load service: org.kie.internal.process.CorrelationKeyFactory
10:06:44.157 [main] ERROR o.k.a.i.utils.ServiceDiscoveryImpl.processKieService:131 - Loading failed because There already exists an implementation for service org.drools.core.reteoo.KieComponentFactoryFactory with same priority 0
Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.drools.dynamic.DynamicServiceRegistrySupplier.get(DynamicServiceRegistrySupplier.java:32)
    at org.drools.dynamic.DynamicServiceRegistrySupplier.get(DynamicServiceRegistrySupplier.java:23)
    at org.kie.api.internal.utils.ServiceRegistry$Impl.getServiceRegistry(ServiceRegistry.java:88)
    at org.kie.api.internal.utils.ServiceRegistry$ServiceRegistryHolder.<clinit>(ServiceRegistry.java:47)
    at org.kie.api.internal.utils.ServiceRegistry.getInstance(ServiceRegistry.java:39)
    at org.kie.api.internal.utils.ServiceRegistry.getService(ServiceRegistry.java:35)
    at org.kie.api.KieServices$Factory$LazyHolder.<clinit>(KieServices.java:358)
    at org.kie.api.KieServices$Factory.get(KieServices.java:365)
    at org.kie.api.KieServices.get(KieServices.java:349)
    at org.drools.examples.DroolsExamplesApp.<init>(DroolsExamplesApp.java:59)
    at org.drools.examples.DroolsExamplesApp.main(DroolsExamplesApp.java:52)
Caused by: java.lang.RuntimeException: Unable to build kie service url = jar:file:/home/davek/apps/drools-distribution-7.46.0.Final/examples/binaries/drools-examples-7.46.0.Final.jar!/META-INF/kie.conf
    at org.kie.api.internal.utils.ServiceDiscoveryImpl.registerConfs(ServiceDiscoveryImpl.java:105)
    at org.kie.api.internal.utils.ServiceDiscoveryImpl.lambda$getServices(ServiceDiscoveryImpl.java:83)
    at java.util.Optional.ifPresent(Optional.java:159)
    at org.kie.api.internal.utils.ServiceDiscoveryImpl.getServices(ServiceDiscoveryImpl.java:81)
    at org.kie.api.internal.utils.ServiceRegistry$Impl.<init>(ServiceRegistry.java:60)
    at org.drools.dynamic.DynamicServiceRegistrySupplier$LazyHolder.<clinit>(DynamicServiceRegistrySupplier.java:27)
    ... 11 more
Caused by: java.lang.RuntimeException: There already exists an implementation for service org.drools.core.reteoo.KieComponentFactoryFactory with same priority 0
    at org.kie.api.internal.utils.ServiceDiscoveryImpl$PriorityMap.put(ServiceDiscoveryImpl.java:222)
    at org.kie.api.internal.utils.ServiceDiscoveryImpl.processKieService(ServiceDiscoveryImpl.java:124)
    at org.kie.api.internal.utils.ServiceDiscoveryImpl.registerConfs(ServiceDiscoveryImpl.java:101)
    ... 16 more

不幸的是,这是我用 this commit 修复的已知问题。 即将推出的 Drools 7.47.0.Final(将于下周发布)不会受到影响。

切换到版本 8.16。0.Beta 或更高版本为我解决了这个问题