-
Bug
-
Resolution: Done
-
Minor
-
7.6.0.Final
-
None
-
2018 Week 07-08
-
-
NEW
-
NEW
To have the rule-files outside the classpath we use the scoredirector feature setScoreDrlFileList but it won't recognize the drool files.
Instead i get an IllegalArgumentException
I used the createSolverByApi() test from the NQeensExample:
snippet:
ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
File ruleFile = new File("src/main/resources/org/optaplanner/examples/nqueens/solver/nQueensScoreRules.drl");
if (ruleFile.exists()) {
scoreDirectorFactoryConfig.setScoreDrlFileList(Arrays.asList(ruleFile));
} else {
return null;
}
solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
...
when the buildSolver() function is called it returns with an expeception.
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.
at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirectorFactory.checkIfGlobalScoreHolderExists(DroolsScoreDirectorFactory.java:96)
at org.optaplanner.core.impl.score.director.drools.LegacyDroolsScoreDirectorFactory.<init>(LegacyDroolsScoreDirectorFactory.java:33)
at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:523)
at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:331)
at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:220)
at org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:61)
at org.optaplanner.examples.nqueens.app.NQueensApp.createSolverByApi(NQueensApp.java:118)
at org.optaplanner.examples.nqueens.app.NQueensAppTest.createSolverByApi(NQueensAppTest.java:30)
- is blocked by
-
DROOLS-2339 Improper handling of FileSystemResource on Windows
- Closed