JCIFS SmbException

Kathir picture Kathir · Feb 16, 2012 · Viewed 11.5k times · Source

I am trying to access a shared folder in my company network via JCIFS. But when i try to list the files under the shared folder, it throws an SmbException as below,

jcifs.smb.SmbException: 0xC000009A
    at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
    at jcifs.smb.SmbTransport.send(SmbTransport.java:663)
    at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:316)
    at jcifs.smb.SmbSession.send(SmbSession.java:218)
    at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
    at jcifs.smb.SmbFile.doConnect(SmbFile.java:911)
    at jcifs.smb.SmbFile.connect(SmbFile.java:954)
    at jcifs.smb.SmbFile.connect0(SmbFile.java:880)
    at jcifs.smb.SmbFile.getType(SmbFile.java:1282)
    at jcifs.smb.SmbFile.doEnum(SmbFile.java:1733)
    at jcifs.smb.SmbFile.listFiles(SmbFile.java:1715)
    at jcifs.smb.SmbFile.listFiles(SmbFile.java:1648)

0xC000009A says it is a NT_STATUS_INSUFFICIENT_RESOURCES but what do i have to do to fix this. The shared folder is only accessible by myself. I used the follwoing url format.

smb://domain;username:password@ip-address/<foldername>

Appreciate your help.

Answer

Nikita Skvortsov picture Nikita Skvortsov · Oct 10, 2012

I faced same error developing file upload to windows shares using JCIFS.

It turned out, target windows machine had an error entry in system log:

Source:        srv
Event ID:      2017
Task Category: None
Level:     Error 
Keywords:      Classic
User:          N/A
Computer:     SERVER01
Description:   The server was unable to allocate from the
system nonpaged pool because the server reached the configured limit
for nonpaged pool allocations.

This error is (possibly) caused by using an older (SMB1, e.g. Windows XP prooflink) version of the protocol when connecting to modern (Vista and above) versions of Windows.

This article contains a workaround for the problem. It requires editing the target machine's registry values, so I can't call it a full solution.