2

我正在尝试使用 Drools Workbench 版本 6.4.0 Final 在 KIE 服务器中重新创建 CloudBalancing 示例。我可以通过 REST API 在 KIE 中创建容器和求解器,但是当我尝试开始求解时出现以下错误:

03:15:50,831 INFO  [org.kie.server.services.impl.KieServerImpl] (EJB default - 2) Container optacloud_1_0_0 (for release id opta:optacloud:1.0.0) successfully started
03:17:44,170 INFO  [org.kie.server.services.optaplanner.SolverServiceBase] (default task-13) Solver 'solver1' successfully created in container 'optacloud_1_0_0'
03:19:19,654 ERROR [org.kie.server.services.optaplanner.SolverServiceBase] (pool-9-thread-1) Exception executing solver 'solver1' from container 'optacloud_1_0_0'. Thread will terminate.: java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333) [rt.jar:1.7.0_80]
    at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1125) [rt.jar:1.7.0_80]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:613) [drools-compiler-6.4.0.Final.jar:6.4.0.Final]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:575) [drools-compiler-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirectorFactory.newKieSession(DroolsScoreDirectorFactory.java:113) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.resetKieSession(DroolsScoreDirector.java:68) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.setWorkingSolution(DroolsScoreDirector.java:61) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.solver.scope.DefaultSolverScope.setWorkingSolutionFromBestSolution(DefaultSolverScope.java:198) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:196) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:175) [optaplanner-core-6.4.0.Final.jar:6.4.0.Final]
    at org.kie.server.services.optaplanner.SolverServiceBase$1.run(SolverServiceBase.java:329) [kie-server-services-optaplanner-6.4.0.Final.jar:6.4.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]

是因为我缺少 SolverConfig.xml 中的“scoreDrl”吗?如何通过工作台 UI 配置 SolverConfig.xml?看来我无法通过界面编辑 SolverConfig.xml。

4

1 回答 1

0

感谢 Geoffrey 的调查,他发现问题的根本原因与DROOLS-1276有关。该问题的解决方法是不使用默认 ksession。

在 Drools 工作台中创建一个 kession 如下:

Project Authoring ->  Open Project Editor -> Knowledge Bases and Sessions

然后在项目的 Solver 配置中更新 Knowledge Session。问题将得到解决。

于 2016-09-07T03:53:55.463 回答