My Code breaks when it reaches to this line.
String resp = restTemplate.postForObject(URL, json, String.class);
On my localhost its working fine but on dev-env server, The error is:
Error occured in java.lang.NoSuchMethodError: com.microsoft.applicationinsights.agent.internal.coresync.impl.ImplementationsCoordinator.httpMethodFinished(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJ)V
The dev-env is Azure Application Service including Java 8 and Tomcat 9.
I got the problem and solution (For others who will get exact same issue as posted): Problem:
restTemplate.postForObject()
was failing, there was conflict because I was usingsetConnectTimeout(10000);
forThe problem was solved when I removed
clientHttpRequestFactory()
from restTemplate and configured default without the connect timeout. Now it's not conflicting.@Gaurav I will mark your answer because your response gave me an idea about the dependency conflict issue.