[jcifs] renameTo

Michael B Allen ioplex at gmail.com
Wed Nov 14 09:26:17 MST 2012

On Mon, Oct 22, 2012 at 1:52 PM, amitsharma551 <amitsharma551 at gmail.com> wrote:
> I am using jcifs-1.3.14-kohsuke-1.jar in my application for DFS server file
> operations.
> I am able to put/delete files in DFS server, but when I am trying to rename
> existed file using renameTo() method. it gives me "jcifs.smb.SmbException:
> The system cannot find the path specified" though I am using same dfs path
> for putting/deleting files. I read post, this issue is fixed in 1.2.24
> jar..I am using recent updated version of jar.
> Please suggest me, what needs to be done this case. Am I need to do any
> configuration for renaming files ?
> I feel, renaming doesn't work DFS ...is that correct ?

Hi Amit,

Renaming should absolutely work with DFS equally well as without.

When you report an issue, it is customary to post the full stack
trace. A proper diagnosis cannot be performed without a full stack

I suspect that the error "The system cannot find the path specified"
is accurate and that you have a replication issue with your DFS
volumes. That error message is coming from the server so the path
supplied by JCIFS is either wrong or the file really is missing. Look
for the file at each location the DFS target is pointing to. I think
you'll find that it's actually not present. However, Windows can
recover from this type of error by iterating through the DFS volumes
until if finds what it's looking for (at least I think this is how it
can still work when there's a replication issue). JCIFS does not
implement that logic. It is on the TODO list (and has been for years

If you post a full stack trace, I might be able to tell you more.

> jcifs.Config.setProperty("jcifs.smb.client.domain", domain);
>         jcifs.Config.setProperty( "jcifs.smb.client.username", userid );
>                 jcifs.Config.setProperty( "jcifs.smb.client.password", password );

You should not set credentials in this way. These properties set the
default credentials and act like the "workstation account" of the
client as though it were a Windows computer.

The correct way to supply credentials is to create an
NtlmPasswordAuthentication object and then pass that to SmbFile*


Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list