Exceptions with SimpleExample.java

Hello,

I am running Jsprit on Windows 10 with Eclipse IDE.
I have installed all dependencies in my library.
However, when running SimpleExample.java, I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException
	at SimpleExample.main(SimpleExample.java:103)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.ConfigurationException
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 1 more

I figured out that this was due to the following line of code:

new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");

When I comment that line I can have the solution printed on my terminal but then I get another exception:

Exception in thread "main" java.lang.NoSuchMethodError: com.graphhopper.jsprit.analysis.toolbox.Plotter$MyActivityRenderer.setBaseItemLabelGenerator(Lorg/jfree/chart/labels/XYItemLabelGenerator;)V
	at com.graphhopper.jsprit.analysis.toolbox.Plotter.getProblemRenderer(Plotter.java:383)
	at com.graphhopper.jsprit.analysis.toolbox.Plotter.createPlot(Plotter.java:414)
	at com.graphhopper.jsprit.analysis.toolbox.Plotter.plot(Plotter.java:302)
	at com.graphhopper.jsprit.analysis.toolbox.Plotter.plot(Plotter.java:280)
	at SimpleExample.main(SimpleExample.java:110)

So my solution cannot be plotted (GraphStreamViewer works though). The exception comes from the file Plotter.class

    problemRenderer.setBaseItemLabelGenerator((arg0, arg1, arg2) -> {
        XYDataItem item = problem.getSeries(arg1).getDataItem(arg2);
        return labelsByDataItem.get(item);
    });

My libraries are Apache Commons Configuration 2.6, Commons Lang 2.6 and Junit 4.13

Thanks for helping me fix this.

1 Like

Are you passing the correct args when running?

I don’t know, I’m just running the basic SimpleExample.java file that’s provided with Jsprit… Just saying that this is where the exception comes from.

Hi,
I had similar problems and i resolved them by using following libraries:
libs
I can make you a download link for the whole folder if you want.