Config.yml setup

graphhopper:
  # OSM data file for Chandigarh
  datareader.file: ./chandigarh-latest.osm.pbf
  
  import.osm.ignored_highways:
  # Location where GraphHopper will store the processed graph data
  graph.location: ./graph-cache
  
  # Vehicle profiles with multiple custom models for user choice
  profiles:
    # Balanced routing - good default for most users
    - name: car_balanced
      profile: car
      weighting: custom
      custom_model_files: ["chandigarh_balanced.json"]
    
    # Fast routing - prioritizes speed and main roads
    - name: car_fast
      profile: car
      weighting: custom
      custom_model_files: ["chandigarh_fast.json"]
    
    # Traffic avoidance - uses smaller roads to avoid congestion
    - name: car_avoid_traffic
      profile: car
      weighting: custom
      custom_model_files: ["chandigarh_avoid_traffic.json"]
    
    # Standard car profile (fallback without custom model)
    - name: car_standard
      profile: car
      weighting: fastest
    
    # Walking profile for pedestrian navigation
    - name: foot
      profile: foot
      weighting: fastest
    
    # Cycling profile
    - name: bike
      profile: bike
      weighting: fastest
  # Enable Contraction Hierarchies for faster queries
  profiles_ch:
    - profile: car_fast  
    - profile: car_avoid_traffic
    - profile: car_standard
    - profile: bike
  # Simple server configuration for local development
  server:
    application_connectors:
      - type: http
        port: 8989
        bind_host: localhost  # Only accessible locally
      - type: http
        port: 8990
        bind_host: localhost

  # Memory settings for local machine
  graph.dataaccess.default_type: RAM_STORE
# Simple logging for development
logging:
  level: INFO
  appenders:
    - type: consoleheres my 

this is my yaml file, i want to load the custom models which are in the same directory as the yaml file

this error is popping up:

ERROR [2025-09-03 13:09:47,952] io.dropwizard.core.cli.ServerCommand: Unable to start server, shutting down
! java.lang.NullPointerException: Cannot invoke “com.graphhopper.util.CustomModel.getPriority()” because “model” is null
! at com.graphhopper.routing.weighting.custom.CustomModelParser.findVariablesForEncodedValuesString(CustomModelParser.java:191)

In case anyone needs the full error output:

(safety_venv) PS D:\Safety Route\graphhopper> java -jar graphhopper-web.jar server config.yaml
INFO [2025-09-03 13:09:47,497] io.dropwizard.core.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO [2025-09-03 13:09:47,500] io.dropwizard.core.server.DefaultServerFactory: Registering admin handler with root path prefix: /
INFO [2025-09-03 13:09:47,735] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: assets for path /maps/*
INFO [2025-09-03 13:09:47,738] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: webjars for path /webjars/*
INFO [2025-09-03 13:09:47,744] io.dropwizard.core.server.ServerFactory: Starting GraphHopperApplication
_ _
__ _ _ __ __ _ _ __ | |__ | |__ ___ _ __ _ __ ___ _ __
/ | '__/ _ | ’ | '_ | '_ \ / _ | '_ | '_ \ / _ \ '|
| (| | | | (| | |) | | | | | | | () | |) | |) | / |
_, || _,| .
/|| ||| ||_/| ./| ./ _||
|
/ || || |_|
INFO [2025-09-03 13:09:47,879] org.eclipse.jetty.setuid.SetUIDListener: Opened application@7ea08277{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
INFO [2025-09-03 13:09:47,879] org.eclipse.jetty.setuid.SetUIDListener: Opened admin@6401d0a0{HTTP/1.1, (http/1.1)}{0.0.0.0:8081}
INFO [2025-09-03 13:09:47,881] org.eclipse.jetty.server.Server: jetty-10.0.23; built: 2024-08-14T01:14:42.815Z; git: 570aa4a1395ca8f9f800045f3a1fe5fe3af9a598; jvm 24.0.2+12-54
INFO [2025-09-03 13:09:47,899] com.graphhopper.GraphHopper: version 10.2|2025-01-20T08:40:08Z (9,23,7,5,2,9)
ERROR [2025-09-03 13:09:47,952] io.dropwizard.core.cli.ServerCommand: Unable to start server, shutting down
! java.lang.NullPointerException: Cannot invoke “com.graphhopper.util.CustomModel.getPriority()” because “model” is null
! at com.graphhopper.routing.weighting.custom.CustomModelParser.findVariablesForEncodedValuesString(CustomModelParser.java:191)
! at com.graphhopper.GraphHopper.lambda$prepareImport$18(GraphHopper.java:843)
! at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:834)
! at com.graphhopper.GraphHopper.prepareImport(GraphHopper.java:843)
! at com.graphhopper.GraphHopper.process(GraphHopper.java:799)
! at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:774)
! at com.graphhopper.http.GraphHopperManaged.start(GraphHopperManaged.java:44)
! at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
! at org.eclipse.jetty.server.Server.start(Server.java:470)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89)
! at org.eclipse.jetty.server.Server.doStart(Server.java:415)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
! at io.dropwizard.core.cli.ServerCommand.run(ServerCommand.java:52)
! at io.dropwizard.core.cli.EnvironmentCommand.run(EnvironmentCommand.java:67)
! at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
! at io.dropwizard.core.cli.Cli.run(Cli.java:78)
! at io.dropwizard.core.Application.run(Application.java:94)
! at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)
INFO [2025-09-03 13:09:47,954] org.eclipse.jetty.server.Server: Stopped Server@7bc6d27a{STOPPING}[10.0.23,sto=30000]
INFO [2025-09-03 13:09:47,954] org.eclipse.jetty.server.Server: Shutdown Server@7bc6d27a{STOPPING}[10.0.23,sto=30000]
WARN [2025-09-03 13:09:47,960] io.dropwizard.core.cli.ServerCommand: Failure during stop server
! java.lang.IllegalStateException: STOPPED
! at org.eclipse.jetty.server.handler.ContextHandler.shutdown(ContextHandler.java:773)
! at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
! at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1716)
! at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
! at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
! at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:636)
! at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:291)
! at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:656)
! at org.eclipse.jetty.util.component.Graceful.shutdown(Graceful.java:146)
! … 8 common frames omitted
! Causing: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: STOPPED
! at java.base/java.util.concurrent.CompletableFuture.wrapInExecutionException(CompletableFuture.java:347)
! at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:442)
! at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2142)
! at org.eclipse.jetty.server.Server.doStop(Server.java:490)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
! at io.dropwizard.core.cli.ServerCommand.run(ServerCommand.java:56)
! at io.dropwizard.core.cli.EnvironmentCommand.run(EnvironmentCommand.java:67)
! at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
! at io.dropwizard.core.cli.Cli.run(Cli.java:78)
! at io.dropwizard.core.Application.run(Application.java:94)
! at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)
java.lang.NullPointerException: Cannot invoke “com.graphhopper.util.CustomModel.getPriority()” because “model” is null
at com.graphhopper.routing.weighting.custom.CustomModelParser.findVariablesForEncodedValuesString(CustomModelParser.java:191)
at com.graphhopper.GraphHopper.lambda$prepareImport$18(GraphHopper.java:843)
at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:834)
at com.graphhopper.GraphHopper.prepareImport(GraphHopper.java:843)
at com.graphhopper.GraphHopper.process(GraphHopper.java:799)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:774)
at com.graphhopper.http.GraphHopperManaged.start(GraphHopperManaged.java:44)
at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.server.Server.start(Server.java:470)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89)
at org.eclipse.jetty.server.Server.doStart(Server.java:415)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at io.dropwizard.core.cli.ServerCommand.run(ServerCommand.java:52)
at io.dropwizard.core.cli.EnvironmentCommand.run(EnvironmentCommand.java:67)
at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
at io.dropwizard.core.cli.Cli.run(Cli.java:78)
at io.dropwizard.core.Application.run(Application.java:94)
at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)

Can you try to specify the custom model directory?

custom_models.directory: ./

i tried that, also looked up in gemini, i feel the issue is in the custom model itself, lemme share it with you, plej helppp meee

chandigarh_avoid_traffic.json (2.5 KB)

chandigarh_balanced.json (2.5 KB)

chandigarh_fast.json (2.7 KB)

heres my new config:

graphhopper:

# OSM data file for Chandigarh

datareader.file: ./chandigarh-latest.osm.pbf

custom_models.directory: .

import.osm.ignored_highways:

# Location where GraphHopper will store the processed graph data

graph.location: ./graph-cache

# Vehicle profiles with multiple custom models for user choice

profiles:

\# Balanced routing - good default for most users

- name: car_balanced

  profile: car

  weighting: custom

  custom_model_files: \['chandigarh_balanced.json'\]



\# Fast routing - prioritizes speed and main roads

- name: car_fast

  profile: car

  weighting: custom

  custom_model_files: \['chandigarh_fast.json'\]



\# Traffic avoidance - uses smaller roads to avoid congestion

- name: car_avoid_traffic

  profile: car

  weighting: custom

  custom_model_files: \['chandigarh_avoid_traffic.json'\]



\# Standard car profile (fallback without custom model)

- name: car_standard

  profile: car

  weighting: fastest



\# Walking profile for pedestrian navigation

- name: foot

  profile: foot

  weighting: fastest



\# Cycling profile

- name: bike

  profile: bike

  weighting: fastest

# Enable Contraction Hierarchies for faster queries

profiles_ch:

- profile: car_fast

- profile: car_avoid_traffic

- profile: car_standard

- profile: bike

# Simple server configuration for local development

server:

application_connectors:

  - type: http

    port: 8989

    bind_host: localhost  # Only accessible locally

  - type: http

    port: 8990

    bind_host: localhost

# Memory settings for local machine

graph.dataaccess.default_type: RAM_STORE

# Simple logging for development

logging:

level: INFO

appenders:

- type: console

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