Calling hopper.importOrLoad from Spark

I try to use GraphHopper within my Spark-Workflow but receive the following error:

Exception in thread "pool-2-thread-1" java.lang.NoSuchMethodError:; at org.openstreetmap.osmosis.osmbinary.Osmformat$HeaderBlock.<init>( at org.openstreetmap.osmosis.osmbinary.Osmformat$HeaderBlock.<init>( at org.openstreetmap.osmosis.osmbinary.Osmformat$HeaderBlock$1.parsePartialFrom( at org.openstreetmap.osmosis.osmbinary.Osmformat$HeaderBlock$1.parsePartialFrom( at at at at at at org.openstreetmap.osmosis.osmbinary.Osmformat$HeaderBlock.parseFrom( at com.graphhopper.reader.pbf.PbfBlobDecoder.processOsmHeader( at com.graphhopper.reader.pbf.PbfBlobDecoder.runAndTrapExceptions( at at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at

My first spark-job was written in Scala, so I thought this might lead to the error. See:
Github Issue

Now I re-implemented the setup with java but get the same error. Might there be some version conflict since both spark and graphhopper use protobuf? I checked that com/google/protobuf/LazyStringList.class is contained within my jar file.

If it helps I can provide some git-Repo with my setup

That could be indeed a problem. If we use an old version we could easily fix this and use the same version. Or if you don’t need to import the area directly in your spark app you could do it separately e.g. via the import script and then it’ll just load it on importOrLoad. Or try with some exclude / include magic.

lots of great ideas. I will try them and give you feedback :slight_smile: thanks so far

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.