Unmarshalling of solverConfigResource fails

Deadly 提交于 2019-12-12 04:16:33

问题


This post is a solution on a previous issue:

OptaPlanner - Problems with the solver configuration for two planning entity classes

This was the error:

Exception in thread "main" java.lang.IllegalArgumentException: Unmarshalling of solverConfigResource (org/optaplanner/examples/nurserostering/solver/nurseRosteringSolverConfig.xml) fails.
at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:114)
at org.optaplanner.core.api.solver.SolverFactory.createFromXmlResource(SolverFactory.java:66)
at org.optaplanner.examples.nurserostering.app.NurseRosteringApp.createSolver(NurseRosteringApp.java:50)
at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:90)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:77)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:73)
at org.optaplanner.examples.nurserostering.app.NurseRosteringApp.main(NurseRosteringApp.java:38)
Caused by: " com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field   org.optaplanner.core.config.heuristic.selector.move.generic.SwapMoveSelectorConfig.valueSelector
---- Debugging information ----
field               : valueSelector
class               :      org.optaplanner.core.config.heuristic.selector.move.generic.SwapMoveSelect    orConfig
required-type       :     org.optaplanner.core.config.heuristic.selector.move.generic.SwapMoveSelect    orConfig
converter-type      :    com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 98
class[1]            :       org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSel    ectorConfig
class[2]            :    org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig
class[3]            : org.optaplanner.core.config.solver.SolverConfig
version             : 1.4.7
-------------------------------
at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:114)
at org.optaplanner.core.api.solver.SolverFactory.createFromXmlResource(SolverFactory.java:66)
at org.optaplanner.examples.nurserostering.app.NurseRosteringApp.createSolver(NurseRosteringApp.java:50)
at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:90)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:77)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:73)
at org.optaplanner.examples.nurserostering.app.NurseRosteringApp.main(NurseRosteringApp.java:38)

回答1:


The problem was caused because in the <swapMoveSelector> i inserted a <valueSelector> tag but as it says in the documentation

The SwapMove selects 2 different planning entities and swaps the planning values of all their planning variables.

The solution was simple: just remove the <valueSelector> from the <swapMoveSelector>



来源:https://stackoverflow.com/questions/36090831/unmarshalling-of-solverconfigresource-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!