[jcifs] Difficulties with smb protocol handler in servlet context
Eric
eglass1 at comcast.net
Thu Sep 25 10:05:02 EST 2003
Gary Rambo wrote:
> I've been having intermittent difficulty registering the smb protocol
> handler when running in a servlet context (Jetty, Struts); but I don't see
> the same problem when running the same code stand-alone.
>
> If I call registerSmbURLHandler() before making any other call to the Jcifs
> library, and then immediately after test the smb url with
>
> URL url = new URL( "smb://servername/" );
>
> I get the MalformedURLException:
>
> java.net.MalformedURLException: unknown protocol: smb
> at java.net.URL.<init>(URL.java:544)
> at java.net.URL.<init>(URL.java:434)
> at java.net.URL.<init>(URL.java:383)
There are various and sundry issues regarding this; see the thread around:
http://lists.samba.org/pipermail/jcifs/2002-December/001639.html
Basically, the SMB url handler class has to be available to the system
classloader; many servlet containers create one or more additional
descendant classloaders for the web application. This typically means
that to successfully register the handler, it must be copied into a
location in your classpath (rather than placed in the "lib" directory of
the web application).
If you are additionally using the NTLM filter, there is potentially
another gotcha; under some containers, the servlet classes
(javax.servlet.*) are themselves loaded in a descendant classloader.
Since you have put the jcifs jar in the system classpath, the NTLM
filter class now isn't able to see it's parent class. One solution here
(under Tomcat anyways) is to move the servlet.jar to the system
classpath as well.
Eric
More information about the jcifs
mailing list