'apache camel/redhat Fuse - http4 component - proxy not working
I am trying to invoke api over internet in our project. It is working while running locally but upon deployment we are getting connection time out error. Please help
My route:
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring" trace="true">
<properties>
<property key="https.proxyHost" value="{{proxyHost}}" />
<property key="https.proxyPort" value="{{proxyPort}}" />
</properties>
<route>
<from id="route-timer" uri="timer://foo?repeatCount=1"/>
<setHeader headerName="Exchange.HTTP_METHOD">
<simple>POST</simple>
</setHeader>
<setHeader headerName="Content-Type">
<simple>application/x-www-form-urlencoded</simple>
</setHeader>
<setBody>
<simple>{{request.payload}}</simple>
</setBody>
<to uri="https4://demo.perfios.com/KuberaVault/insights/institutions?connectTimeout=100000" />
</route>
</camelContext>
We are using openshift platform for deployment and curl is working fine on OCP pod. But route execution is failing. Proxy is already set on pod level but still it is failing.
Error:
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[supportedInstituti] [supportedInstituti] [timer://foo?repeatCount=1 ] [ 100494]
[supportedInstituti] [log1 ] [log ] [ 8]
[supportedInstituti] [setHeader1 ] [setHeader[Exchange.HTTP_METHOD] ] [ 2]
[supportedInstituti] [setHeader2 ] [setHeader[Content-Type] ] [ 0]
[supportedInstituti] [setHeader3 ] [setHeader[CamelHttpQuery] ] [ 1]
[supportedInstituti] [setBody1 ] [setBody[simple{payload=<payload><apiVersion>2.1</apiVersion><destination>accou] [ 205]
[supportedInstituti] [to1 ] [https4://demo.perfios.com/KuberaVault/insights/institutions?connectTimeout=100] [ 100274]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.http.conn.ConnectTimeoutException: Connect to demo.perfios.com:443 [demo.perfios.com/35.154.198.217] failed: connect timed out
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:334)
at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:193)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:181)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
Curl command on OCP pod is working fine:
oc rsh testadapter-1-gtwkm
sh-4.2$ curl -kv https://demo.perfios.com/KuberaVault/insights/institutions
* About to connect() to proxy <<host>> port <<port>> (#0)
* Trying 157.227.4.5...
* Connected to <<host>> port <<port>>(#0)
* Establish HTTP proxy tunnel to demo.perfios.com:443
> CONNECT demo.perfios.com:443 HTTP/1.1
> Host: demo.perfios.com:443
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=*.perfios.com,O=Perfios Software Solutions Pvt Ltd,L=Bengaluru,ST=Karnataka,C=IN
* start date: Sep 29 00:00:00 2021 GMT
* expire date: Oct 30 23:59:59 2022 GMT
* common name: *.perfios.com
* issuer: CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US
> GET /KuberaVault/insights/institutions HTTP/1.1
> User-Agent: curl/7.29.0
> Host: demo.perfios.com
> Accept: */*
>
< HTTP/1.1 400 400
< Date: Sun, 17 Apr 2022 11:17:54 GMT
< Server: Apache
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Set-Cookie: JSESSIONID=BB7B2319BF8B42600F846305D2E50DEC; Path=/KuberaVault; Secure; HttpOnly
< Content-Length: 97
< Connection: close
< Content-Type: application/xml;charset=UTF-8
<
**<Error>
<code>BadParameter</code>
<message>Payload is required but missing</message>**
* Closing connection 0
</Error>sh-4.2$
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
