Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] NPE in HttpClient.send when using in docker

Hi there,

we have an odd problem with using the jetty http client in a multi-container docker environment.

We have a java server in one container and a different http server in another container. They are linked together correctly as described in the docker documentation. In order to fetch some data from the other http server, the java server uses the jetty http client to make an async get request. For some reason the hostname resolution seem to be broken since jetty client throws a NPE. 

java.lang.NullPointerException
    at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:525) ~[jetty-client-9.2.15.v20160210.jar:9.2.15.v20160210]
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:694) ~[jetty-client-9.2.15.v20160210.jar:9.2.15.v20160210]
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:678) ~[jetty-client-9.2.15.v20160210.jar:9.2.15.v20160210]

jetty client version: 9.2.15.v20160210
docker version: 1.9.1 (AWS beanstalk)
java docker image: java:8-jre

Steps to reproduce:
1) run a http server docker image
2) create a java program to call this http server with jetty http client
3) first, run the http docker, then run the java docker with linking-in the http server
4) make a request with the jetty http client by using as hostname the docker name of the other http server (e.g. "http://other_http_server:8080")
(This scenario works perfectly well with other software components using the same docker mechanism, only jetty client makes troubles at the moment)

With the very same code but outside of a docker environment - meaning, two regular servers in a normal network environment -  it works normal as expected.

Any ideas, thoughts?

Thanks,
Gregor

Back to the top