Should I read this stack trace as two separate issues? Seems I didn't map the slf4j dependency correclty? Why would I have to do that? Wouldn't that be something inherited from the other project (OptaPlanner)? I'm working with OptaPlanner and experimenting with a modification to the CloudBalancing project. When I run the app I get the following:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.IllegalArgumentException: The solverConfigResource (scheduleConfig.xml) does not exist as a classpath resource in the classLoader (jdk.internal.loader.ClassLoaders$AppClassLoader@42a57993). at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:110) at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:87) at org.optaplanner.core.api.solver.SolverFactory.createFromXmlResource(SolverFactory.java:65) at com.eddiefiggie.schedulelogic.App.main(App.java:10)
In addition to the slf4j issue reported, it seems my scheduleConfig.xml isn't mapped properly? I followed the documentation and thought I was ok. Maybe the error being reported can be explained to my "green" java mind.
EDIT based on:
Modified my POM to include:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>runtime</scope>
</dependency>
Also placed my xml config in the correct resources path.
Now I get this stack:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/home/eddiefiggie/.m2/repository/com/thoughtworks/xstream/xstream/1.4.11.1/xstream-1.4.11.1.jar) to field java.util.TreeMap.comparator WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.IllegalArgumentException: Unmarshalling of solverConfigResource (scheduleConfig.xml) fails on line number (8).
Maybe the classname on line number (8) is surrounded by whitespace, which is invalid. at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:117) at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:87) at org.optaplanner.core.api.solver.SolverFactory.createFromXmlResource(SolverFactory.java:65) at com.eddiefiggie.schedulelogic.App.main(App.java:10) Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot load java class ScheduleEasyScoreCalculator ---- Debugging information ---- message : Cannot load java class ScheduleEasyScoreCalculator 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 : 8 class[1] : org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig required-type[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 required-type[2] : org.optaplanner.core.config.solver.SolverConfig version : 1.4.11.1 ------------------------------- 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:499) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:499) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72) 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:1487) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1467) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1338) at org.optaplanner.core.config.solver.SolverConfig.createFromXmlReader(SolverConfig.java:202) at org.optaplanner.core.config.solver.SolverConfig.createFromXmlInputStream(SolverConfig.java:176) at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:112)
The solverConfigResource (scheduleConfig.xml) does not exist as a classpath resource in the classLoader
It means there is no file at src/main/resources/scheduleConfig.xml
.
Often your solver config XML is namespaced, so call something like createFromXmlResource("org/foo/bar/scheduleConfig.xml")
to look for it at src/main/resources/org/foo/bar/scheduleConfig.xml"
.