[jcifs] Static Class Problems

Michael B Allen ioplex at gmail.com
Mon Sep 28 13:35:32 MDT 2009

Hi Brian,

The static global nature of jcifs.Config has discussed and it will be
changed in 2.0 (whenever that happends) so that properties are stored
using thread local storage and thus can be changed on-demand.

However a few things:

1. If each cluster uses it's own JVM then you should be able to set
properties independently so what you're saying doesn't really make a
lot of sense.

2. Note that the jcifs.smb.client.{domain,username,password}
properties are just used as default values. They are not required to
be set at all and in fact it is considered superior to explicitly
supply credential using the NtlmPasswordAuthentication class and
associated SmbFile constructors.

3. All properties managed by the jcifs.Config class are things that
should not change from one network to another. They are all things
that on Windows would be set in the registry or are a property of the
domain or name server and so on. So in theory you should not need to
change them at all since you could not change them at runtime on a
Windows computer or on a Samba server.


On Mon, Sep 28, 2009 at 1:57 PM, Brian Detweiler
<bdetweiler.work at gmail.com> wrote:
> Hello,
> I am writing to make you aware of a particular use case with static classes
> being a problem.
> First off, I realize you are busy and will likely not change this anytime
> soon (if ever), but on the off-chance someone is bored, this would be a nice
> thing to have working.
> Here's the use case: We run a ColdFusion clustered environment on Linux RHEL
> 5. We have 16 servers, with a total of about 10 clusters on each. Each
> cluster is a separate instance of a JVM, and it is shared by many people
> developing ColdFusion apps.
> We encountered the need to provide Samba access through ColdFusion, and
> JCIFS was easy to integrate as a custom tag. CF is a tag-based language
> fully integrated with Java, and you can write custom tags in Java that
> basically work like Java classes in ColdFusion.
> We noticed a problem though, when interacting with two different Samba
> shares (requiring different credentials) in the same ColdFusion script.
> After much frustration, and eventually digging through the JCIFS code, it
> became apparent that the static config class essentially will not allow this
> behavior. We are basically limited to one set of credentials per cluster,
> which severely limits its usefulness.
> Again, while I understand this may not be a priority, I did want to make you
> aware of this use case.
> Peace,
> Brian Detweiler

Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list