作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我从 git 克隆了 optaplanner-examples 以了解如何针对我的问题案例实现该库。
我修改了示例 PassionAdmissionSchedule,我只想要没有 swing 的代码。当我想启动求解器时,收到以下错误消息。
Exception in thread "main" java.lang.IllegalArgumentException: Unmarshalling of solverConfigResource (test/patientAdmissionScheduleSolverConfig.xml) fails.
at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:114)
at org.optaplanner.core.api.solver.SolverFactory.createFromXmlResource(SolverFactory.java:90)
at test.PatientAdmissionScheduleApp.init(PatientAdmissionScheduleApp.java:29)
at test.PatientAdmissionScheduleApp.main(PatientAdmissionScheduleApp.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot load java class
test.BedDesignationPillarPartSwapMoveFactory
---- Debugging information ----
message : Cannot load java class
test.BedDesignationPillarPartSwapMoveFactory
class : java.lang.Class
required-type : java.lang.Class
converter-type : com.thoughtworks.xstream.converters.SingleValueConverterWrapper
wrapped-converter : com.thoughtworks.xstream.converters.extended.JavaClassConverter
line number : 25
class[1] : org.optaplanner.core.config.heuristic.selector.move.factory.MoveListFactoryConfig
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[2] : org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelect orConfig
class[3] : org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig
class[4] : org.optaplanner.core.config.solver.SolverConfig
version : 1.4.9
-------------------------------
解算器配置是相同的。
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<!--<environmentMode>FAST_ASSERT</environmentMode>-->
<solutionClass>test.PatientAdmissionSchedule</solutionClass>
<entityClass>test.BedDesignation</entityClass>
<scoreDirectorFactory>
<scoreDrl>patientAdmissionScheduleScoreRules.drl</scoreDrl>
</scoreDirectorFactory>
<termination>
<secondsSpentLimit>300</secondsSpentLimit>
</termination>
<constructionHeuristic>
<constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector/>
<!--<swapMoveSelector/>-->
<!--<pillarSwapMoveSelector/>-->
<moveListFactory>
<moveListFactoryClass>
test.BedDesignationPillarPartSwapMoveFactory
</moveListFactoryClass>
</moveListFactory>
</unionMoveSelector>
<acceptor>
<entityTabuSize>7</entityTabuSize>
</acceptor>
<forager>
<acceptedCountLimit>1000</acceptedCountLimit>
</forager>
</localSearch>
错误消息显示,java 无法加载类 BedDesignationPillarSwapMoveFactory,但为什么呢?
最佳答案
line number : 25
检查求解器配置 XML 的第 25 行。
这无效:
<moveListFactoryClass>
test.BedDesignationPillarPartSwapMoveFactory
</moveListFactoryClass>
这是有效的:
<moveListFactoryClass>test.BedDesignationPillarPartSwapMoveFactory</moveListFactoryClass>
假设该包中有一个包含该类的 java 包测试。
关于java - optaplanner-示例 : Unmarshalling of solverConfigResource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42577946/
我从 git 克隆了 optaplanner-examples 以了解如何针对我的问题案例实现该库。 我修改了示例 PassionAdmissionSchedule,我只想要没有 swing 的代码。
我是一名优秀的程序员,十分优秀!