2017-03-03 3 views
0

私はgitのoptaplanner-examplesからクローンを作成し、私の問題のためにライブラリを実装する方法を学びました。optaplanner-examples:solverConfigResourceのアンマーシャリング

例PassionAdmissionScheduleを変更し、スイングなしのコードのみを使用します。ソルバを開始したいときに、私はエラーメッセージが出ます。

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をロードできないことを言うが、なぜ?

答えて

0

行番号:ソルバーの設定XMLの25

チェック行番号25。

これは有効ではありません。

 <moveListFactoryClass> 
      test.BedDesignationPillarPartSwapMoveFactory 
     </moveListFactoryClass> 

これは有効です。

 <moveListFactoryClass>test.BedDesignationPillarPartSwapMoveFactory</moveListFactoryClass> 

推測そのパッケージで、そのクラスとJavaのパッケージテストがあること。

関連する問題