[jcifs] jcifs.smb.SmbException: The handle is invalid

Mathi mathi at oxseed.com
Fri May 7 01:24:01 MDT 2010


I am getting jcifs.smb.SmbException: The handle is invalid while copying
a file from AIX to windows share directory. This error occurs in the middle
of copying. 

    byte[] b = new byte[4096];
    int i=0;
    SmbFile file = new SmbFile(url);
    OutputStream out = new SmbFileOutputStream(file);
    BufferedInputStream bis = new BufferedInputStream(is);
    while ((i = bis.read(b)) != -1) {
        out.write(b, 0, i);

out.write() throws "handle is invalid" exception after some iterations.
Stack trace(JCIFS 1.3.12):
jcifs.smb.SmbException: The handle is invalid.
	at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
	at jcifs.smb.SmbTransport.send(SmbTransport.java:644)
	at jcifs.smb.SmbSession.send(SmbSession.java:224)
	at jcifs.smb.SmbTree.send(SmbTree.java:111)
	at jcifs.smb.SmbFile.send(SmbFile.java:770)
	at jcifs.smb.SmbFileOutputStream.writeDirect(SmbFileOutputStream.java:245)
	at jcifs.smb.SmbFileOutputStream.write(SmbFileOutputStream.java:216)

I am using JCIFS 1.3.12 in the production. 
1. I tried with JCIFS 1.3.14, but it also gives same error.
2. I tried  with following config(5minutes timeout), but still I get same error.
		jcifs.Config.setProperty( "jcifs.smb.client.soTimeout", "300000");
		jcifs.Config.setProperty( "jcifs.smb.client.responseTimeout", "300000");
		jcifs.Config.setProperty( "jcifs.netbios.soTimeout", "300000");
Sometimes I get "Handle is invalid" error while reading file from Windows share

Could you please help?

Thank you

More information about the jCIFS mailing list