git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rép. : host not found when using http4 in docker container


try this
start your docker witch --network=hostcoreservices

then http4:hostcoreservices:8080/coreservices/rest/v1/services

dont miss to add the hostcoreservices in you DNS

Cliquer pour ajouter une signature
( gwsig:addsig) 







>>> 
I'm running camel inside a Docker container and trying to use the HTTP4 
component to post a request to a service running in a different 
container (both containers are managed through Docker compose).
Essentially I'm trying to do a post to a route like this:
http4:coreservices:8080/coreservices/rest/v1/services
where coreservices is the name of the other container.

This fails with a  java.net.UnknownHostException (see below).
But the other container is definitely accessible from this container as 
if I open a shell in it I can the curl the 'coreservices' host.

Any idea what's going wrong here?

Thanks
Tim


05-Jun-2018 17:09:34.667 SEVERE [localhost-startStop-1] 
org.apache.camel.util.CamelLogger.log Failed delivery for (MessageId: 
ID-4b81ce1e6383-46459-1528218572076-1-3 on ExchangeId: 
ID-4b81ce1e6383-46459-1528218572076-1-2). Exhausted after delivery 
attempt: 1 caught: java.net.UnknownHostException: coreservices: Name or 
service not known

Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId Processor Elapsed (ms)
[route6            ] [route6            ] 
[direct://post-service-descriptors ] [       283]
[route6            ] [log1              ] [log ] [         5]
[route6            ] [process1          ] [Processor@0xa8e9d5 ] [       173]
[route6            ] [to1               ] 
[http4:coreservices:8080/coreservices/rest/v1/services ] [        95]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
  java.net.UnknownHostException: coreservices: Name or service not known
     at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
     at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
     at 
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
     at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
     at java.net.InetAddress.getAllByName(InetAddress.java:1192)
     at java.net.InetAddress.getAllByName(InetAddress.java:1126)
     at 
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
     at 
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
     at 
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
     at 
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
     at 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
     at 
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
     at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
     at 
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
     at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
     at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
     at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
     at 
org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306)
     at 
org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178)
     at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
     at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
     at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
     at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
     at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
     at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
     at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
     at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
     at 
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
     at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
     at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)
     at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497)
     at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)
     at 
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:497)
     at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:242)
     at 
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:148)
     at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:156)
     at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:173)
     at 
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:305)




>>> 
I'm running camel inside a Docker container and trying to use the HTTP4 
component to post a request to a service running in a different 
container (both containers are managed through Docker compose).
Essentially I'm trying to do a post to a route like this:
http4:coreservices:8080/coreservices/rest/v1/services
where coreservices is the name of the other container.

This fails with a  java.net.UnknownHostException (see below).
But the other container is definitely accessible from this container as 
if I open a shell in it I can the curl the 'coreservices' host.

Any idea what's going wrong here?

Thanks
Tim


05-Jun-2018 17:09:34.667 SEVERE [localhost-startStop-1] 
org.apache.camel.util.CamelLogger.log Failed delivery for (MessageId: 
ID-4b81ce1e6383-46459-1528218572076-1-3 on ExchangeId: 
ID-4b81ce1e6383-46459-1528218572076-1-2). Exhausted after delivery 
attempt: 1 caught: java.net.UnknownHostException: coreservices: Name or 
service not known

Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId			  ProcessorId Processor Elapsed (ms)
[route6		    ] [route6 		   ] 
[direct://post-service-descriptors ] [	   283]
[route6		    ] [log1 			 ] [log ] [		 5]
[route6		    ] [process1 		 ] [Processor@0xa8e9d5 ] [	   173]
[route6		    ] [to1 			  ] 
[http4:coreservices:8080/coreservices/rest/v1/services ] [	    95]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
  java.net.UnknownHostException: coreservices: Name or service not known
	 at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
	 at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	 at 
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	 at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
	 at java.net.InetAddress.getAllByName(InetAddress.java:1192)
	 at java.net.InetAddress.getAllByName(InetAddress.java:1126)
	 at 
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
	 at 
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
	 at 
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	 at 
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	 at 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	 at 
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	 at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	 at 
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	 at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	 at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
	 at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
	 at 
org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306)
	 at 
org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178)
	 at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	 at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
	 at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	 at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
	 at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
	 at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
	 at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
	 at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
	 at 
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
	 at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
	 at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
	 at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)
	 at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497)
	 at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)
	 at 
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:497)
	 at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:242)
	 at 
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:148)
	 at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:156)
	 at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:173)
	 at 
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:305)




"Le présent courriel peut contenir des renseignements confidentiels et ne s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce courriel vous est parvenu par mégarde, veuillez le supprimer et nous en aviser aussitôt."