Input file is not of valid type data/osm_file.pbf

Hi. I have been able to install ORS locally and run it on heidelberg.osm.gz. However, when I point to a different file (tried a few different files, as small as 23 MB in .osm format), the docker image is generated and the docker container is started but http://localhost:8080/ors/health reports {“status”:“not ready”}. When I run docker logs 42cf58de69e4 I get this error traceback:

26 Feb 07:57:49 ERROR [routing.RoutingProfileManager] - Failed to initialize RoutingProfileManager instance.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Problem while parsing file
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_242]
	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_242]
	at org.heigit.ors.routing.RoutingProfileManager.initialize(RoutingProfileManager.java:162) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfileManager.getInstance(RoutingProfileManager.java:57) ~[classes/:6.0.0]
	at org.heigit.ors.servlet.listeners.ORSInitContextListener.lambda$contextInitialized$0(ORSInitContextListener.java:40) ~[classes/:6.0.0]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
Caused by: java.lang.RuntimeException: Problem while parsing file
	at com.graphhopper.reader.osm.OSMReader.preProcess(OSMReader.java:228) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.reader.osm.OSMReader.readGraph(OSMReader.java:172) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.importData(GraphHopper.java:717) ~[graphhopper-core-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:688) ~[graphhopper-core-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:666) ~[graphhopper-core-v0.12.2.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:130) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:173) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:119) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.0.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_242]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_242]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_242]
	... 1 more
Caused by: java.lang.IllegalArgumentException: Input file is not of valid type data/osm_file.pbf
	at com.graphhopper.reader.osm.OSMInputFile.decode(OSMInputFile.java:129) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.reader.osm.OSMInputFile.<init>(OSMInputFile.java:56) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.reader.osm.OSMReader.openOsmInputFile(OSMReader.java:333) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.reader.osm.OSMReader.preProcess(OSMReader.java:189) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.reader.osm.OSMReader.readGraph(OSMReader.java:172) ~[graphhopper-reader-osm-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.importData(GraphHopper.java:717) ~[graphhopper-core-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:688) ~[graphhopper-core-v0.12.2.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:666) ~[graphhopper-core-v0.12.2.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:130) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:173) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:119) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.0.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.0.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_242]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_242]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_242]
	... 1 more
26-Feb-2020 07:57:49.787 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 312 ms
26-Feb-2020 07:57:49.810 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
26-Feb-2020 07:57:49.858 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
26-Feb-2020 07:57:49.878 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 25152 ms
26 Feb 07:58:13 ERROR [http.BaseHttpServlet] - org.heigit.ors.exceptions.StatusCodeException: Routing service is not ready yet.

Which I think boils down to: ** Input file is not of valid type data/osm_file.pbf**

I followed the instructions and modified the .yaml file. Even in openrouteservice/src/main/resources/ I modified the app.config.sample file and replaced heidelberg.osm.gz with my own file, but no luck (same error).

Could you please verify that this procedure works with a file different than the default one (heidelberg.osm.gz)?

Thx!

Yes, it does work.

Can you share your docker-compose.yml and do a tree -L3 . where the docker-compose is located?

Thx, here is the docker-compose.yaml:
version: ‘3’
services:
ors-app:
container_name: ors-app
ports:
- 8080:8080
build:
context: …/
args:
APP_CONFIG: ./docker/conf/app.config.sample
OSM_FILE: ./docker/data/Home.osm
JAVA_OPTS: -Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g
CATALINA_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost
volumes:
- ./graphs:/ors-core/data/graphs
- ./elevation_cache:/ors-core/data/elevation_cache
- ./logs/ors/:/var/log/ors/
- ./logs/tomcat/:/usr/local/tomcat/logs

And here is the output of tree -L 3 .:

Did you build the image yourself or did you use the dockerhub prebuilt image?

If you did build the Docker image yourself, based on this folder structure, that’s not right. Please consult https://github.com/GIScience/openrouteservice/blob/master/docker on a fresh git clone and follow the instructions in there. You can’t change the whole structure and not account for it in the docker-compose.yml.

Hi,

I haven’t changed anything besides placing the additional .osm files in the data folder. In any case, I removed the existing folder and ran this steps:

I got the same results as before. I really don’t see where I am going wrong, since the steps are pretty straightforward.

What is the correct tree structure that I should be seeing?

I forgot to mention that I am using MacOS. Do you know if there is anything I should be doing differently for Mac?

Thx.

Just a .osm ending doesn’t sound right. Of course, file endings are mostly syntactic sugar, I think GH might not be able to deal with it. A lot of tools expect to have the proper file endings, in this case .pbf, whatever comes before is irrelevant. Usually the files downloaded from Geofabrik have .osm.pbf. I wouldn’t change that if I were you. Tools like osmium don’t like that either.

Thx.

https://github.com/GIScience/openrouteservice/tree/master/docker mentions that .osm files are supported (please see image below).

I was using exports obtained from https://www.openstreetmap.org/export, which are in .osm format. I downloaded a small file from Geofabrik in .osm.pbf format and it worked! So I guess the extract itself was the problem and there are no issues with my folder structure.

Cheers.

Well, glad to accept a PR to fix the documentation!

.osm is really a XML file. So if you try .osm.xml it might work. Not really sure if it supports xml tbh. If not, there’s always osmium & osmosis to convert to PBF. XML is really not the right format to distribute OSM data, 10 x as big as PBF.

Did this ever get resolved? I feel I am having similar issues with this osm_file.pbf . I follow the steps perfectly. Do everything as clean as possible, and I get and error that boils down to

Couldn’t process file data/osm_file.pbf

23 Mar 04:38:00 ERROR [routing.RoutingProfileManager] - java.util.concurrent.ExecutionException: java.lang.RuntimeException: Couldn't process file data/osm_file.pbf, error: Couldn't map buffer 0 of 69 for srtm_38_03.gh at position 100 for 72000000 bytes with offset 100, new fileLength:72351844

Can you share your active app.config & docker-compose.yml & do a tree . in the docker folder?

It looks like an issue with the elevation tiles… you might want to try the same but disabling elevation in the app.config. Depending on which version of ORS you use you might have to rebuild the image or at least copy the app.config to an active container’s target location,

Or try the new dockerfile, docker-compose & instructions (update yesterday):