[jcifs] jcifs.smb.SmbException: The handle is invalid
mathi at oxseed.com
Mon May 10 23:00:17 MDT 2010
Thanks for the reply.
The "handle is invalid" exception is thrown because of j-interop, I guess.
Let me descirbe it.
When I create SmbFile instance, I pass the url that contains user information,
share directory name but NOT Domain name like below.
Url= > smb://user:firstname.lastname@example.org/share/1.doc
So JCIFS, by default, gets domain name from System properties.
I am also using j-interop in my project to communicate with DCOM objects on windows.
In j-interop source(JISession.java), I found the following line
System.setProperty("jcifs.smb.client.domain","JIDomain");//is being put in for completing type2 message
//somehow windows is not taking empty domain name.
This sets the domain name as "JIDomain".
So, whenever I create SmbFile passing URL without Domain, it takes the Domain name
set by j-interop.
I do not know for what purpose j-interop uses JCIFS. But this is what creating problems.
I guess, the opearation(read or write) on Smbfile works fine as long as j-interop keeps its
connection alive. When j-interop disconnects(log off) its smb connection(i do not know when),
then any read/write on SmbFile throws "Handle is invalid" exception.
Do you have an idea about this? Is this right?
I think, I can fix this problem by properly passing domain name in the URL that is used
to created SmbFile instance.
Michael B Allen wrote:
> Hi Mathi,
> Try examples/Put.java and do not set any properties at all (you can
> pass the domain / account name / password in the URL from the
> commandline. Does that also reproduce the "handle is invalid"
> If yes, get a packet capture of the error and send it to me directly
> as an attachment. I'm not sure what capture programs are available for
> AIX but there's probably something like tcpdump. Otherwise you could
> run the capture from the Windows side.
More information about the jCIFS