GraphHopper.com | Forum | GitHub | Maps | Blog

Need run the graphhopper as a background job


#1

I need run the graphhopper as a background job.

Earlier I tried to start it from the .jar file with the command: java -Dgraphhopper.datareader.file=kaliningrad-latest.osm.pbf -jar graphhopper-web-0.12-SNAPSHOT.jar server config-example.yml

and get the response:

INFO [2018-11-30 22:26:57,770] org.eclipse.jetty.server.handler.ContextHandler: Started i.d.j.MutableServletContextHandler@18f805a{/,null,AVAILABLE}
INFO [2018-11-30 22:26:57,779] org.eclipse.jetty.server.AbstractConnector: Started application@187bac9{HTTP/1.1,[http/1.1]}{192.168.1.218:8989}
INFO [2018-11-30 22:26:57,780] org.eclipse.jetty.server.AbstractConnector: Started admin@18280e6{HTTP/1.1,[http/1.1]}{192.168.1.218:8990}
INFO [2018-11-30 22:26:57,780] org.eclipse.jetty.server.Server: Started @2123ms

Then stop service:
INFO [2018-11-30 22:57:39,230] org.eclipse.jetty.server.AbstractConnector: Stopped application@187bac9{HTTP/1.1,[http/1.1]}{192.168.1.218:8989}
INFO [2018-11-30 22:57:39,231] org.eclipse.jetty.server.AbstractConnector: Stopped admin@18280e6{HTTP/1.1,[http/1.1]}{192.168.1.218:8990}
INFO [2018-11-30 22:57:39,232] org.eclipse.jetty.server.handler.ContextHandler: Stopped i.d.j.MutableServletContextHandler@18f805a{/,null,UNAVAILABLE}
INFO [2018-11-30 22:57:39,236] org.eclipse.jetty.server.handler.ContextHandler: Stopped i.d.j.MutableServletContextHandler@1c747a{/,null,UNAVAILABLE}

Then for the same version:
./graphhopper.sh -a web -i kaliningrad-latest.osm.pbf -d --port 8989

## using java 1.8.0_191 from

## using existing osm file kaliningrad-latest.osm.pbf

## existing jar found web/target/graphhopper-web-0.12-SNAPSHOT.jar

## now web. JAVA_OPTS=-Xmx1000m -Xms1000m

ebarybina@Rcut:/opt/graphhopper$ INFO [2018-11-30 23:02:42,002] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO [2018-11-30 23:02:42,006] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
INFO [2018-11-30 23:02:42,204] io.dropwizard.bundles.assets.ConfiguredAssetsBundle: Registering ConfiguredAssetBundle with name: assets for path /maps/*
INFO [2018-11-30 23:02:42,214] io.dropwizard.server.ServerFactory: Starting GraphHopperApplication
_ _
__ _ _ __ __ _ _ __ | |__ | |__ ___ _ __ _ __ ___ _ __
/  *`| '__/ _`  | '*  | '_ | '_ \ / _ | '_ | '_ \ / _ \ ' <strong>|
| ( *| | | | (* | | | *) | | | | | | | (* ) | | *) | |* ) |  <strong>/ |
_ *, |* | _ *,* | .</strong> /| *| |* | *| |* |_</strong> /| . **/| .** / _ <strong>| <em>|
|</em></strong> / | *| |* | |_|

ERROR [2018-11-30 23:02:42,349] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
! java.net.BindException: Address already in use
! at sun.nio.ch.Net.bind0(Native Method)
! at sun.nio.ch.Net.bind(Net.java:433)
! at sun.nio.ch.Net.bind(Net.java:425)
! at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
! at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
! at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:331)
! at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:299)
! at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:200)
! ... 8 common frames omitted
! Causing: java.lang.RuntimeException: java.net.BindException: Address already in use
! at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:213)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarting(AbstractLifeCycle.java:188)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:67)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
! at io.dropwizard.cli.Cli.run(Cli.java:78)
! at io.dropwizard.Application.run(Application.java:93)
! at com.graphhopper.http.GraphHopperApplication.main(GraphHopperApplication.java:33)
java.lang.RuntimeException: java.net.BindException: Address already in use
at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:213)
at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarting(AbstractLifeCycle.java:188)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:67)
at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at com.graphhopper.http.GraphHopperApplication.main(GraphHopperApplication.java:33)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:331)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:299)
at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:200)
... 8 more

How to start now background job on the port 8989?


#2

Well, there’s that. So check to see what’s running in that port.