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

XStream parsing of solver configuration fails due to Eclipse's reformatting that introduces whitespace: improve error message

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.Final
    • None
    • optaplanner-core
    • None
    • NEW
    • NEW

      This solver config part:

      <easyScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.optional.score.CloudBalancingEasyScoreCalculator
            </easyScoreCalculatorClass>
      

      creates this error:

      Exception in thread "main" java.lang.IllegalArgumentException: Unmarshalling of solverConfigResource (org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.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 org.optaplanner.examples.cloudbalancing.app.CloudBalancingApp.createSolver(CloudBalancingApp.java:51)
      	at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:97)
      	at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:84)
      	at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:80)
      	at org.optaplanner.examples.cloudbalancing.app.CloudBalancingApp.main(CloudBalancingApp.java:37)
      	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 org.optaplanner.examples.cloudbalancing.optional.score.CloudBalancingEasyScoreCalculator
          
      ---- Debugging information ----
      message             : Cannot load java class org.optaplanner.examples.cloudbalancing.optional.score.CloudBalancingEasyScoreCalculator
          
      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         : 13
      class[1]            : org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig
      converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
      class[2]            : org.optaplanner.core.config.solver.SolverConfig
      version             : 1.4.9
      -------------------------------
      	at com.thoughtworks.xstream.converters.extended.JavaClassConverter.fromString(JavaClassConverter.java:71)
      	at com.thoughtworks.xstream.converters.SingleValueConverterWrapper.fromString(SingleValueConverterWrapper.java:41)
      	at com.thoughtworks.xstream.converters.SingleValueConverterWrapper.unmarshal(SingleValueConverterWrapper.java:49)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:503)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:429)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:281)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:503)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:429)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:281)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
      	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1230)
      	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1214)
      	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085)
      	at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:142)
      	at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:133)
      	at org.optaplanner.core.impl.solver.XStreamXmlSolverFactory.configure(XStreamXmlSolverFactory.java:112)
      	... 11 more
      
      

      and beginning users don't understand why it is happening. Improve the error message

            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: