[jcifs] Error writing to a share folder

Michael B Allen ioplex at gmail.com
Tue Oct 1 00:10:25 MDT 2013


On Fri, Sep 13, 2013 at 6:52 PM, Jose Luis Martinez Avial
<jlmartinez at pb-santander.com> wrote:
> Hello,
>
>                 I’m having some issues writing to a share folder in a
> Windows server (I don’t know the specific windows version).I basically
> create a SmbFile, and then a SmbFileOutputStream with that file, and start
> writing on that stream in blocks of 100k:
>
>
<snip code>
>
>                 The issue is that for each out.write, I see a bunch of logs:
>
> jcifs.smb.SmbException: The system cannot find the file specified.
>
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
>
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:640)
>
>         at jcifs.smb.SmbSession.send(SmbSession.java:238)
>
>         at jcifs.smb.SmbTree.send(SmbTree.java:119)
>
> […]
>
>         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
>
>         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
> doConnect: 0.0.0.0<00>/xxx.xxx.xxx.xxx
>
> open0: \yyyyyy\DT1317500232.pdf
>
> jcifs.smb.SmbException: The system cannot find the file specified.
>
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
>
>
>
>
>
>                 The file is copied correctly, but the error messages are
> bothering me. I’m using jcifs 1.3.17, with the default configuration, and
> I’m using the IP address of the server, not the server name. What could be
> the problem. I took a tcpdump while copying the files, so I can provide it
> if needed.

Hi José,

This error message is coming from the server. You can see the method
called is "checkStatus" which means JCIFS is just reporting the status
of the last command sent to the server. So I think the error message
actually means what it sounds like - the file is in fact not present
for some reason.

My guess would be that you have a race condition in your application.
Meaning after createFile is called the file has been deleted. If this
is the case, one solution would be to simply not call createNewFile().
If you really need to call createNewFile() for some logical reason,
you might try to create a new SmbFile object so that the state of the
file is created anew at the point of writing.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jCIFS mailing list