Https being downgraded to http in 10.14v

Hello,

I have a java agent (sdk v10.14) and it points to c8y environment v10.14. when i try to get inventory obj from platform object secure https url is being downgraded to http and failing eventually throwing connection timed out.

Downgraded screenshot:

Error:

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to thegear-staging.iot-trialpack.com:80 [thegear-staging.iot-trialpack.com/180.12.186.103] failed: Connection timed out (Connection timed out)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:483) ~[jersey-apache-connector-2.35.jar!/:na]
        ... 27 common frames omitted
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
        at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]
        at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75) ~[httpclient-4.5.13.jar!/:4.5.13]
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[httpclient-4.5.13.jar!/:4.5.13]
        ... 36 common frames omitted

When i point same agent to c8y v10.6 environment, it works fine. So does any one know what could be causing this and how to fix it?

Thanks
Bishan

I think that the application hasn’t been created yet in your 10.14 environment. Also the logs in the background of your screen states that no credentials haven been set so I assume the platform is not correctly initialized with the correct credentials.

How is the platform initialized?

Actually its an agent. We do not want to create it as a serverside application. Sorry for that background, Its misleading. Please ignore that. I had used @MicroserviceApplication in the main class. Check the below image which is the updated one.

This is how platform object is initialized.

What is the return value of platformDetails.getServiceUrl() in both environment 10.14 and 10.6?

1 Like

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