[jcifs] More classloader issues

Glass, Eric eric.glass at capitalone.com
Thu Dec 12 23:45:25 EST 2002

Ok.  Installing jCIFS as an extension (or otherwise available to the system
classloader) will resolve the issue with SMB URLs.  However, when you
attempt to use NtlmFilter, you get:

java.lang.NoClassDefFoundError: javax/servlet/Filter

This is caused by the fact that NtlmFilter is now installed under the system
classloader, while the core servlet classes are under the servlet
container's classloader; since NtlmFilter is being loaded by the system
classloader, it can no longer access its own superclass.  What this implies
is that when the SMB URL support classes are properly installed and
available, the NtlmFilter is not.

The only way I was able to get a servlet/JSP which uses SMB URLs working
under the NtlmFilter was to amend build.xml to create 2 jars; one contains
the core jCIFS classes (and should be installed as an extension or otherwise
under the system classloader).  The other contains the http stuff, and
should be installed under the web application classloader (i.e., in

Does anyone have another recommendation?  This should also work if the user
copies the core servlet jars into their extension directory, but I don't
know if it's really feasible to require users to monkey around with their
servlet container.  Installing a URLStreamHandlerFactory would allow the use
of SMB URLs without requiring that the jCIFS classes are placed under the
system classpath; however, you can only install a stream handler factory
once within a JVM.  This would cause additional issues for Tomcat users as
well, since that container already installs a URLStreamHandlerFactory.

The upside of this is that it does separate out the servlet-oriented stuff
from the core SMB stuff.


Attached is:

build.xml -- the amended build file which contains changes to the "jar"
index.jsp -- an example JSP which creates an SMB URL
web.xml -- a deployment descriptor to apply the NtlmFilter to index.jsp

The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: web.xml
Type: application/octet-stream
Size: 646 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20021212/beac53be/web.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: index.jsp
Type: application/octet-stream
Size: 397 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20021212/beac53be/index.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.xml
Type: application/octet-stream
Size: 4025 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20021212/beac53be/build.obj

More information about the jcifs mailing list