2016-12-11 16 views
0

から正常に動作します。このプロジェクトを実行可能にするために、Eclipseのエクスポートウィザードを使用してjarファイルとしてエクスポートしました。Optaplanner - エラー実行可能なjarファイルを実行しているが、私は私のoptaplannerプロジェクト開発のための日食使用して、私は何の問題もなく日食から私のコードを実行することができる午前日食

その後、私はコマンドjava -jar myOptaPlanner.jarを使用して、端末からの私のjarファイルを実行し、その後、私はエラー

WARN given scan urls are empty. set urls in the configuration 
Exception in thread "main" java.lang.IllegalStateException: The scanAnnotatedClasses 
(ScanAnnotatedClassesConfig()) did not find any classes with a PlanningSolution 
annotation. 
Maybe you forgot to annotate a class with a PlanningSolution annotation. 
Maybe you're using special classloading mechanisms (OSGi, ...) and this is a bug. 
If you can confirm that, report it to our issue tracker and workaround it by 
defining the classes explicitly in the solver configuration. 
at org.optaplanner.core.config.domain.ScanAnnotatedClassesConfig.loadSolutionClass(ScanAnnotatedClassesConfig.java:106) 
at org.optaplanner.core.config.domain.ScanAnnotatedClassesConfig.buildSolutionDescriptor(ScanAnnotatedClassesConfig.java:86) 
at org.optaplanner.core.config.solver.SolverConfig.buildSolutionDescriptor(SolverConfig.java:270) 
at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:216) 
at org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:57) 
at org.roster.app.WorkerRosteringApp.main(WorkerRosteringApp.java:36) 

の下に取得するには、これは本当にバグですか、私はそれが間違って輸出していますか?

アップデート:私はmaven-shade-pluginを使用してjarファイルをエクスポートしようとしたともここで私は同じエラーを取得しています。

おかげ

+0

を見つけることができます

<scanAnnotatedClasses> <packageInclude>your.package.here</packageInclude> </scanAnnotatedClasses> 

ドキュメントこのカバーの下で、OptaPlannerはorg.reflectionsを使用してクラスパスをスキャンします。私は何の問題もなくジャーでこれをテストしました。あなたは、OSGi、ジグソーパズル、JBossのモジュールまたはその他の特別なクラスローディング環境を使用していますか? –

答えて

2

scanAnnotatedClassesはjarファイルに動作するようには思えません。その代わり、この問題を回避する次の使用:

<solutionClass>path.to.your.SolutionClass</solutionClass> 
<entityClass>path.to.your.EntityClassI</entityClass> 
<entityClass>path.to.your.EntityClassII</entityClass> 

とあなたの設定ファイルにscanAnnotatedClassesを削除します。

+0

おかげであなたの助けのためにたくさん...それは今働いています。これをバグとして投稿しなければならないと思いますか? – Selva

+0

はい、これはバグがあり、(https://issues.jboss.org/projects/PLANNER)[ここでそれを報告]、クリーンな再生 –

+0

を提供したり、より良いまだ、このコードをデバッグすることにより、[問題が何であるかを把握してください](https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-core/src/main/java/org/optaplanner/core/config/domain/ScanAnnotatedClassesConfig.java#L86)、あなたが貢献したい場合。 –

0

あなたが解決策とエンティティクラスを含むパッケージを含む、手動で解決してエンティティクラスを宣言したくない場合も回避策として働く約<packageInclude>here

関連する問題