4

I have an android application that uses the jcifs library. Every time I try to openConnection() on an URL using HTTP protocol I get an IOExeption with the following message "Unable to find default handler for protocol: http". it works just fine with URLs using FTP protocol.

After some digging I suspect that the problem is from jcifs library.From the JCIFS documentation I found the following :

The jCIFS NTLM support is implemented as a URLStreamHandler for HTTP connections. This handler "wraps" the default handler provided by your Java environment to add support for NTLM authentication.

Add the "jcifs" package to the list of protocol handler packages. The "java.protocol.handler.pkgs" property is a pipe-separated ("|") list of packages which supply protocol handlers to Java.The "jcifs" package should be added to this list; this would typically be done by adding "-Djava.protocol.handler.pkgs=jcifs" to the command line when starting the application...

see full article

Can anyone help fix this problem.

Community
  • 1
  • 1

1 Answers1

0

Try to add this:

jcifs.Config.registerSmbURLHandler();

before you create your connection. This will install the jcifs package on your project.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Bao Pham
  • 577
  • 7
  • 11