[英]Optaplanner - The benchmarkConfigResource does not exist as a classpath resource in the classLoader
I'm new to OptaPlanner and I'm focusing on benchmarking . 我是OptaPlanner的新手 ,我专注于基准测试 。 I started playing around with the benchmark in Eclipse .
我开始尝试使用Eclipse中的基准测试。 I followed the documentation ( http://docs.jboss.org/optaplanner/release/6.4.0.Final/optaplanner-docs/html_single/index.html#buildAndRunAPlannerBenchmark ), but when trying to run, I got this error :
我遵循了文档( http://docs.jboss.org/optaplanner/release/6.4.0.Final/optaplanner-docs/html_single/index.html#buildAndRunAPlannerBenchmark ),但是在尝试运行时,出现此错误 :
Exception in thread "main" java.lang.IllegalArgumentException: The benchmarkConfigResource (prova/src/prova/nurseRosteringBenchmarkConfig.xml) does not exist as a classpath resource in the classLoader (sun.misc.Launcher$AppClassLoader@73d16e93).
at org.optaplanner.benchmark.impl.XStreamXmlPlannerBenchmarkFactory.configure(XStreamXmlPlannerBenchmarkFactory.java:100)
at org.optaplanner.benchmark.api.PlannerBenchmarkFactory.createFromXmlResource(PlannerBenchmarkFactory.java:45)
at prova.ClasseJava.main(ClasseJava.java:10)
Maybe I'm doing something wrong in Java (I need to review it), so here is my code : 也许我在Java中做错了(我需要复习一下),所以这是我的代码 :
package prova;
import org.optaplanner.benchmark.api.PlannerBenchmark;
import org.optaplanner.benchmark.api.PlannerBenchmarkFactory;
public class ClasseJava {
public static void main(String[] args) {
System.out.println("Ok - Before");
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(
"prova/src/prova/nurseRosteringBenchmarkConfig.xml");
System.out.println("Ok - After");
PlannerBenchmark plannerBenchmark = plannerBenchmarkFactory.buildPlannerBenchmark();
plannerBenchmark.benchmark();
}
}
Info : I've placed the file nurseRosteringBenchmarkConfig.xml in the same ClasseJava 's package ( prova ). 信息 :我已经将文件NurseRosteringBenchmarkConfig.xml放在相同的ClasseJava包( prova )中。
Thank you for a little help. 谢谢您的帮助。
Classpath resources are like package names and full classnames. 类路径资源类似于程序包名称和完整类名称。 Since your packagename is "prova", your classpath resource is "prova/nurseRosteringBenchmarkConfig.xml".
由于您的程序包名称为“ prova”,因此您的类路径资源为“ prova / nurseRosteringBenchmarkConfig.xml”。
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(
"prova/nurseRosteringBenchmarkConfig.xml");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.