Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-710

Benchmark: Fail fast when using non-XML input solution format and <solutionFileIOClass> is not specified

XMLWordPrintable

    • NEW
    • NEW

      If <solutionFileIOClass> is not defined, the benchmarker tries to parse the input file as XML which results in XStream exception. It would be better to fail fast and guide the user to provide org.optaplanner.persistence.common.api.domain.solution.SolutionFileIO implementation.

      2016-12-15 12:33:30,336 [main] INFO  Benchmarking started: parallelBenchmarkCount (1) for problemCount (1), solverCount (1), totalSubSingleCount (1).
      2016-12-15 12:33:30,356 [main] WARN  The subSingleBenchmarkRunner (input01_Late Acceptance_0) failed.
      java.lang.IllegalArgumentException: Failed reading inputSolutionFile (input01.xlsx).
      	at org.optaplanner.persistence.xstream.impl.domain.solution.XStreamSolutionFileIO.read(XStreamSolutionFileIO.java:64) ~[optaplanner-persistence-xstream-7.0.0.Beta4.jar:7.0.0.Beta4]
      	at org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult.readPlanningProblem(ProblemBenchmarkResult.java:296) ~[optaplanner-benchmark-7.0.0.Beta4.jar:7.0.0.Beta4]
      	at org.optaplanner.benchmark.impl.SubSingleBenchmarkRunner.call(SubSingleBenchmarkRunner.java:83) ~[optaplanner-benchmark-7.0.0.Beta4.jar:7.0.0.Beta4]
      	at org.optaplanner.benchmark.impl.SubSingleBenchmarkRunner.call(SubSingleBenchmarkRunner.java:34) ~[optaplanner-benchmark-7.0.0.Beta4.jar:7.0.0.Beta4]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_60]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_60]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_60]
      	at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_60]
      Caused by: com.thoughtworks.xstream.io.StreamException: 
      	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54) ~[xstream-1.4.9.jar:1.4.9]
      	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085) ~[xstream-1.4.9.jar:1.4.9]
      	at org.optaplanner.persistence.xstream.impl.domain.solution.XStreamSolutionFileIO.read(XStreamSolutionFileIO.java:62) ~[optaplanner-persistence-xstream-7.0.0.Beta4.jar:7.0.0.Beta4]
      	... 7 common frames omitted
      Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not P (position: START_DOCUMENT seen P... @1:1) 
      	at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519) ~[xpp3_min-1.1.4c.jar:na]
      	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395) ~[xpp3_min-1.1.4c.jar:na]
      	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093) ~[xpp3_min-1.1.4c.jar:na]
      	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109) ~[xstream-1.4.9.jar:1.4.9]
      	... 15 common frames omitted
      2016-12-15 12:33:30,377 [main] INFO  Generating benchmark report...
      2016-12-15 12:33:30,998 [main] INFO  Benchmarking failed: time spent (23), failureCount (1), statistic html overview (/path/local/data/2016-12-15_123330/index.html).
      Exception in thread "main" org.optaplanner.benchmark.api.PlannerBenchmarkException: Benchmarking failed: failureCount (1). The exception of the firstFailureSingleBenchmarkRunner (roster-10spots-28days_Late Acceptance_0) is chained.
      	at org.optaplanner.benchmark.impl.DefaultPlannerBenchmark.benchmarkingEnded(DefaultPlannerBenchmark.java:322)
      	at org.optaplanner.benchmark.impl.DefaultPlannerBenchmark.benchmark(DefaultPlannerBenchmark.java:105)
      	at org.optaplanner.training.workerrostering.app.WorkerBenchmarkApp.main(WorkerBenchmarkApp.java:16)
      	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:497)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      Caused by: java.lang.IllegalArgumentException: Failed reading inputSolutionFile (input01.xlsx).
      	at org.optaplanner.persistence.xstream.impl.domain.solution.XStreamSolutionFileIO.read(XStreamSolutionFileIO.java:64)
      	at org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult.readPlanningProblem(ProblemBenchmarkResult.java:296)
      	at org.optaplanner.benchmark.impl.SubSingleBenchmarkRunner.call(SubSingleBenchmarkRunner.java:83)
      	at org.optaplanner.benchmark.impl.SubSingleBenchmarkRunner.call(SubSingleBenchmarkRunner.java:34)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: com.thoughtworks.xstream.io.StreamException: 
      	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
      	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
      	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
      	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
      	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085)
      	at org.optaplanner.persistence.xstream.impl.domain.solution.XStreamSolutionFileIO.read(XStreamSolutionFileIO.java:62)
      	... 7 more
      Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not P (position: START_DOCUMENT seen P... @1:1) 
      	at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
      	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
      	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
      	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
      	... 15 more
      

              rsynek@redhat.com Radovan Synek (Inactive)
              mcimbora_jira Matej Čimbora (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: