We are trying to access the Lithium Rest Api (its a https site) through Spring Rest Template as below
`String plainCreds = lswUserName + ":" + lswPassword; byte[] plainCredsBytes = plainCreds.getBytes(); byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); String base64Creds = new String(base64CredsBytes); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + base64Creds); HttpEntity<String> request = new HttpEntity<String>(headers); ResponseEntity<String> sRawResp = restTemplate.exchange(completeURL.toString(), HttpMethod.GET, request, String.class);' Above code always gives org.springframework.web.client.HttpClientErrorException: 401 Unauthorized Exception There were no issues when invoking the same web service through postman, however whenever accessed through java code, getting the above 401 unauthorized exception Previously I faced this issue with Windows OS, I struggled a lot and got the solution. The Soultion was, In Tomcat/bin folder I have added below entry related to proxy in to catalina.bat file set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=hy**1.*****.co.in -Dhttp.proxyPort=8080 " This resolved the issue in Windows OS. Now we moved the entire setup to Linux OS and now i get the same error. Here in linux i don't have any proxy set. checked through wget http://www.google.com<http://www.google.com/> (Here no proxy details displayed). In this case how to resolve this issue in Linux when no proxy is set. Please Help. DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.