HTTP 401 Error on Exchange Web Service Invocation Using NTLMv2 on Linux (Doc ID 1543034.1)

Last updated on MAY 05, 2013

Applies to:

Java Platform, Standard Edition - Version 1.6.0 to 1.6.0 [Release 1.6]
Generic Linux

Symptoms

A HTTP 401 error is raised when invoking an Exchange WebService (EWS), which relies on NTLM v2 for all service requests, even for just getting the WSL.  The error is thrown by a client running a stand-alone Java application on Linux and using the java.net.URLConnection API.  When the client program is run on Windows, it works fine.

(i)  See java testcase: HttpURLConxMain.java (attached)

 

Using the java.net.URLConnection or javax.net.ssl.HttpsURLConnection, the authentication fails with the following output:

 

java.lang.Exception: Erreur HTTP : 401 - Unauthorized
     at HttpURLConxMain.callEWS(HttpURLConxMain.java:99)
     at HttpURLConxMain.main(HttpURLConxMain.java:38)
Exception in thread "Main Thread" java.lang.RuntimeException: java.lang.Exception: Erreur HTTP : 401 - Unauthorized
     at HttpURLConxMain.callEWS(HttpURLConxMain.java:104)
     at HttpURLConxMain.main(HttpURLConxMain.java:38)

 

(ii) See java testcase: HttpClientMain.java (attached)

 

When using org.apache.http.impl.client.DefaultHttpClient, it works fine.  So, the issue happens during authentication using Java's API.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms