[jcifs] Using CXF with NTLM/JCIFS authentication as well as SSL/HTTPS

Pink, Simon (AGCS) simon.pink at allianz.com
Thu Dec 3 04:24:48 MST 2009

I cannot seem to get jcifs NTLM working with SSL/HTTPS. I get the following exception:
   java.lang.NoSuchMethodException<http://java.sun.com/javase/6/docs/api/java/lang/NoSuchMethodException.html>: jcifs.http.NtlmHttpURLConnection.getSSLSocketFactory()

In a nutshell, CXF is trying to decorate the javax.net.ssl.HttpsURLConnection.getSSLSocketFactory method - but NTLM has replaced the https connection with its own handler: NtlmHttpURLConnection which doesn't have this method, hence the exception. Is it actually possible to use both SSL and NTLM using CXF (or any other JAX-WS implementation)? I have posted this on the CXF mailing list, but I have been directed here.

I'm banging my head against a wall at the moment! Any help would be greatly appreciated.

I am using the NTLM Authentication<http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html> example almost verbatim, and then used a conduit to allow HTTPS:
    //Set the jcifs properties
    jcifs.Config.setProperty("jcifs.smb.client.domain", "my.domain.com");
    jcifs.Config.setProperty("jcifs.netbios.wins", "my.wins.server.com");
    jcifs.Config.setProperty("jcifs.smb.client.soTimeout", "300000"); //5 minutes
    jcifs.Config.setProperty("jcifs.netbios.cachePolicy", "1200"); //20 minutes
//    jcifs.Config.setProperty("jcifs.smb.client.username", "myNTLogin");
//    jcifs.Config.setProperty("jcifs.smb.client.password", "secret");

    //Register the jcifs URL handler to enable NTLM

    ClientProxyFactoryBean factory = new ClientProxyFactoryBean(new JaxWsClientFactoryBean());

    factory.setServiceClass( ListsSoap.class );
    factory.setAddress( "https://my.service.endpoint.url" );
    ListsSoap client = (ListsSoap) factory.create();
    Client proxy = ClientProxy.getClient( client );

    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();

    HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
    TLSClientParameters tcp = new TLSClientParameters();
    tcp.setTrustManagers( new TrustManager[]{ new TrustAllX509TrustManager() } );
    conduit.setTlsClientParameters( tcp );

    GetListCollectionResult col  = client.getListCollection();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20091203/a6a4f84a/attachment.html>

More information about the jCIFS mailing list