JCIFS SmbException

2019-04-22 17:15发布

问题:

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.

回答1:

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.



回答2:

Updated link for the registry changes needed:

https://social.technet.microsoft.com/Forums/windows/en-US/30919e4f-6810-48d6-8769-2cff61f07544/event-id-2017-the-server-was-unable-to-allocate-from-the-system-nonpaged-pool-because-the-server?forum=w7itpronetworking



标签: smb jcifs