API Server configuration error

I’ve tried to set up Openrouteservice API docker server on Windows 11 WSL2 by different ways and docker container runs without errors but doesn’t respond correctly for queries. It’s folder where I tried commands

mkdir -p conf elevation_cache graphs logs/ors logs/tomcat
docker-compose up -d

docker run -dt -u “${UID}:${GID}”
–name ors-app
-p 8080:8080
-v $PWD/graphs:/ors-core/data/graphs
-v $PWD/elevation_cache:/ors-core/data/elevation_cache
-v $PWD/conf:/ors-conf
-v /mnt/c/OSMFiles/malopolskie-latest.osm.pbf:/ors-core/data/osm_file.pbf
-e “JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g”
-e “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”
openrouteservice/openrouteservice:v6.6.1

Below there is example log of running in docker

Package openrouteservice and deploy to Tomcat ###
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
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
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/openjdk-11
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
08-Nov-2021 04:16:06.953 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.39
08-Nov-2021 04:16:06.954 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Mar 14 2019 11:24:26 UTC
08-Nov-2021 04:16:06.954 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.39.0
08-Nov-2021 04:16:06.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
08-Nov-2021 04:16:06.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 5.10.60.1-microsoft-standard-WSL2
08-Nov-2021 04:16:06.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
08-Nov-2021 04:16:06.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-11
08-Nov-2021 04:16:06.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.11+9
08-Nov-2021 04:16:06.956 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
08-Nov-2021 04:16:06.956 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
08-Nov-2021 04:16:06.956 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
08-Nov-2021 04:16:06.959 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
08-Nov-2021 04:16:06.960 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
08-Nov-2021 04:16:06.960 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
08-Nov-2021 04:16:06.961 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
08-Nov-2021 04:16:06.961 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
08-Nov-2021 04:16:06.962 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
08-Nov-2021 04:16:06.962 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:TargetSurvivorRatio=75
08-Nov-2021 04:16:06.962 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:SurvivorRatio=64
08-Nov-2021 04:16:06.963 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxTenuringThreshold=3
08-Nov-2021 04:16:06.963 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseG1GC
08-Nov-2021 04:16:06.964 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+ScavengeBeforeFullGC
08-Nov-2021 04:16:06.964 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:ParallelGCThreads=4
08-Nov-2021 04:16:06.964 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms1g
08-Nov-2021 04:16:06.965 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx2g
08-Nov-2021 04:16:06.965 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
08-Nov-2021 04:16:06.965 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
08-Nov-2021 04:16:06.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
08-Nov-2021 04:16:06.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote
08-Nov-2021 04:16:06.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=9001
08-Nov-2021 04:16:06.967 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.rmi.port=9001
08-Nov-2021 04:16:06.967 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
08-Nov-2021 04:16:06.967 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
08-Nov-2021 04:16:06.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=localhost
08-Nov-2021 04:16:06.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
08-Nov-2021 04:16:06.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
08-Nov-2021 04:16:06.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
08-Nov-2021 04:16:06.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
08-Nov-2021 04:16:06.970 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
08-Nov-2021 04:16:06.999 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [“http-nio-8080”]
08-Nov-2021 04:16:07.006 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
08-Nov-2021 04:16:07.018 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [“ajp-nio-8009”]
08-Nov-2021 04:16:07.019 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
08-Nov-2021 04:16:07.027 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 381 ms
08-Nov-2021 04:16:07.076 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
08-Nov-2021 04:16:07.077 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.39
08-Nov-2021 04:16:07.112 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ors.war]

. ____ _ __ _ _
/\ / __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ’ / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
’ |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.3.5.RELEASE)

08 Nov 04:16:12 INFO [ors.Application] - Starting Application v6.6.1 on 8461e4e1b937 with PID 120 (/usr/local/tomcat/webapps/ors/WEB-INF/classes started by root in /ors-core)
08 Nov 04:16:12 DEBUG [ors.Application] - Running with Spring Boot v2.3.5.RELEASE, Spring v5.2.10.RELEASE
08 Nov 04:16:12 INFO [ors.Application] - No active profile set, falling back to default profiles: default
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See SLF4J Error Codes for further details.
08 Nov 04:16:14 INFO [ors.Application] - Started Application in 3.118 seconds (JVM running for 8.356)
08-Nov-2021 04:16:14.667 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

<?xml version="1.0" ?> /var/log/ors/ors-logs.log 08 Nov 04:16:14 INFO [routing.RoutingProfileManager] - Total - 1.00 GB, Free - 767.77 MB, Max: 2 GB, Used - 258.23 MB 08 Nov 04:16:14 INFO [routing.RoutingProfileManager] - 08 Nov 04:16:14 INFO [routing.RoutingProfileManager] - ====> Initializing profiles from 'data/osm_file.pbf' (1 threads) ... 08 Nov 04:16:14 INFO [routing.RoutingProfileManager] - 08 Nov 04:16:14 INFO [routing.RoutingProfileManager] - 08-Nov-2021 04:16:14.739 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/ors.war] has finished in [7,627] ms 08-Nov-2021 04:16:14.741 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager] 08 Nov 04:16:14 INFO [routing.RoutingProfile] - [1] Profiles: 'driving-car', location: 'data/graphs/car'. 08-Nov-2021 04:16:14.775 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [35] ms 08-Nov-2021 04:16:14.775 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples] 08-Nov-2021 04:16:14.919 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [144] ms 08-Nov-2021 04:16:14.920 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs] 08-Nov-2021 04:16:14.933 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [12] ms 08-Nov-2021 04:16:14.933 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROOT] 08-Nov-2021 04:16:14.944 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [11] ms 08-Nov-2021 04:16:14.944 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager] 08-Nov-2021 04:16:14.962 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [17] ms 08-Nov-2021 04:16:14.974 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 08-Nov-2021 04:16:14.991 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 08-Nov-2021 04:16:14.993 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 7965 ms 08 Nov 04:16:16 INFO [routing.RoutingProfile] - [1] FlagEncoders: 1, bits used [UNKNOWN]/64. 08 Nov 04:16:16 INFO [routing.RoutingProfile] - [1] Capacity: [UNKNOWN]. (edges - 20863, nodes - 15462) 08 Nov 04:16:16 INFO [routing.RoutingProfile] - [1] Total time: 1.515s. 08 Nov 04:16:16 INFO [routing.RoutingProfile] - [1] Finished at: 2021-11-08 04:16:16. 08 Nov 04:16:16 INFO [routing.RoutingProfile] - 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - Total time: 1.569s. 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - ======================================================================== 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - ====> Recycling garbage... 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - Before: Total - 1.00 GB, Free - 463.27 MB, Max: 2 GB, Used - 562.73 MB 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - After: Total - 1024 MB, Free - 943.43 MB, Max: 2 GB, Used - 80.57 MB 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - ======================================================================== 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - ====> Memory usage by profiles: 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - [1] 20.03 MB (24.9%) 08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - Total: 20.03 MB (24.9%)

08 Nov 04:16:16 INFO [routing.RoutingProfileManager] - ========================================================================

Query to web api works correctly
Not working local instance

localhost:8080/ors/v2/directions/foot-walking?api_key=&start=19.920064%2C50.021153&end=19.936780%2C50.013371

{“error”:{“code”:2099,“message”:“Unable to get an appropriate route profile for RoutePreference = foot-walking”},“info”:{“engine”:{“version”:“6.6.1”,“build_date”:“2021-11-08T04:14:54Z”},“timestamp”:1636345001547}}

Hi,
the error is saying that the foot profile hasn’t been built, so it is likely that either this is missing from your modified configuration file, or the container is not refreshing the graphs.

The first thing to check is that your modified ors-config.json file inside the conf folder has the foot profile activated. If that is the case, then you should delete the contents of the graphs folder, and then restart the container which should then rebuild the graphs.

I have finally set up ORS Server.
I will write below how I did it for other people with similar problems:

  1. I modified file docker-compose.yml. I corrected paths, I changed BUILD_GRAPHS setting for True and I added file path of OSM data.

version: ‘2.4’
services:
ors-app:
container_name: ors-app
ports:
- 8080:8080
image: openrouteservice/openrouteservice:latest
build:
context: …/
args:
ORS_CONFIG: ./docker/conf/ors-config.json
OSM_FILE: ./docker/data/malopolskie-latest.osm.pbf
volumes:
- ./graphs:/ors-core/data/graphs
- ./elevation_cache:/ors-core/data/elevation_cache
- ./logs/ors:/var/log/ors
- ./logs/tomcat:/usr/local/tomcat/logs
- ./conf:/ors-conf
- ./data/malopolskie-latest.osm.pbf:/ors-core/data/osm_file.pbf
environment:
- BUILD_GRAPHS=True # Forces the container to rebuild the graphs, e.g. when PBF is changed
- “JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -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”

  1. I updated that line in ors-config.json to activate walking.

@adam Thanks for indicating that it was associated with selection of activity.