Thanks for the clear recipe!

I've documented step 2 and 3 in the optaplanner manual (step 1 is already partially documented and the other part is documented in guvnor's docs).

Step 4 sounds like a bug, so please raise an issue
if uploading the optaplanner-core jar as a POJO model jar, still causes a NoClassDefFoundError unless you put the jar in guvnor's WEB-INF/lib dir too:
  https://issues.jboss.org/browse/GUVNOR

On 25-06-13 14:12, Bartek wrote:
I get it to work. Four steps where needed:
1. Adding

 private KnowledgeBase kBase;//injected with Spring
....
        // Build the Solver
        SolverFactory solverFactory = new XmlSolverFactory("/planner/solverConfig.xml");
        RuleBase ruleBase = ((InternalKnowledgeBase) kBase).getRuleBase();
        solverFactory.getSolverConfig().getScoreDirectorFactoryConfig().setRuleBase(ruleBase);
 
to my code to link Guvnor and solverFactory.
 
And spring integration with Drools:

   <drools:kbase id="knowledgeBase"/>
    <drools:kagent kbase="knowledgeBase" id="kagent" new-instance="false">
        <drools:resources>
            <drools:resource type="PKG"
                             source="${drools.url}"
                             basic-authentication="enabled"
                             username="admin"
                             password="admin"/>
        </drools:resources>
    </drools:kagent>

 <bean id="planner" class="...">
        <property name="kBase" ref="knowledgeBase"/>
    </bean>

2. Importing drools-planner-core-5.5.0.Final.jar in Guvnor (Upload POJO Model jar)
3. Adding global in Guvnor:
  global org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScoreHolder scoreHolder
4. Adding drools-planner-core-5.5.0.Final.jar to WEB-INF/lib in Guvnor instalation directory. Without that I still get NoClassDefFoundError while importing my domain in Guvnor.

Best regards

W dniu 2013-06-18 10:52, Geoffrey De Smet pisze:


Is it generally good idea to try use guvnor to define scores?
Yes, if you need that flexibility, as it allows you to change your score rules through the guvnor web interface.
However, this is mostly uncharted territory: some users have already successfully done it (there are mails on this mailing list's archive),
but there's little documentation and no example for it. Feel to do a write up once you get it to work, for the next person wanting to do this :)




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users