javaclasspathoptaplannerkie-workbench

(Optaplanner 7.0)What is different between Execution Server and Optaplanner-Example project?


First, make DataObjects for define domain, some rules for calculate score, solver config xml in KIE-Workbench 7.0.0.CR3.

Using Build & Deploy, execution server solve the problem.

After check my jar file(Workbench's result), I copy optaplanner-examples java project and delete packeges except org.optaplanner.exapample.common package in eclipse.

Make main app like CloudBalancingHellowWorld.java, and define persistence for Data I/O.

After adding Workbench's jar file, they return some error message like below.

Exception in thread "main" java.lang.IllegalArgumentException: The kieBase with kiePackages([]) has no global field called scoreHolder. 
Check if the rule files are found and if the global field is spelled correctly.

How can I solve this problem?

Or, how can I use workbench's result jar file without Execution Server?

cf. In my workbench's result jar file, there is some classes and *.gdrl, *.rdrl, *.solver.xml. But in solver.xml, they don't mention about gdrl, rdrl.


Solution

  • With below blog's step, I solve my problem.

    http://www.atehome.net/optaplanner-integration-with-drools-workbench/

    Since I don't know why I do like that, but I works well.

    In rough step,

    1. Define KieService Manually.

    2. Define Repository from KieServices.

    3. Read Resource from workbench's result(Jar file).

    4. Define KieModule using Resource.

    5. Make KieContainer to Kieservices using KieModule.

    6. Then Do Build Solver using createFromKieContainerXmlResource Method(This is new method for 7.0.0 version)

    But there is some question for above step.

    In example project, I think above step done automatically. But using jar file, why I do manually above step?