MapMatching constructor requires missing trove dependency?

Trying to run the map matching example, after slightly adapting it to fit the new map matching constructor, I receive the following error:

Exception in thread “main” java.lang.NoClassDefFoundError: gnu/trove/TIntCollection
Caused by: java.lang.ClassNotFoundException: gnu.trove.TIntCollection

On the last line of the following code:

String algorithm = Parameters.Algorithms.DIJKSTRA_BI;
Weighting weighting = new FastestWeighting(encoder);
AlgorithmOptions algoOptions = new AlgorithmOptions(algorithm, weighting);
MapMatching mapMatching = new MapMatching(hopper, algoOptions);

Adding the following dependency seems to solve this problem but creates a new one:
(remove spaces after every <)
> < dependency>

           < groupId>net.sf.trove4j < /groupId>
           < artifactId>trove4j < /artifactId>
           < version>3.0.3 < /version>
    < /dependency>

The new problem is then as follows, which might be caused by this new dependency:
Exception in thread “main” java.lang.NoSuchMethodError: com.graphhopper.storage.index.LocationIndexTree.findNetworkEntries(DDLgnu/trove/set/hash/TIntHashSet;I)Z
at com.graphhopper.matching.LocationIndexMatch.findNClosest(LocationIndexMatch.java:67)
at com.graphhopper.matching.MapMatching.createTimeSteps(MapMatching.java:214)
at com.graphhopper.matching.MapMatching.doWork(MapMatching.java:170)

Thank you for any help!

There should not be any dependencies issues. Is this for the master branch?

Sorry for wasting your time!
I found the problem already, somewhere in a pom file I was using the 0.8.2 version of map matching core, changing this to 0.9-SNAPSHOT solved everything and it seems to work now.

1 Like