Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JCIFS SmbException

Tags:

smb

jcifs

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.

like image 230
Kathir Avatar asked Feb 16 '12 18:02

Kathir


2 Answers

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.

like image 62
Nikita Skvortsov Avatar answered Oct 19 '22 19:10

Nikita Skvortsov


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

like image 41
Enrique Avatar answered Oct 19 '22 18:10

Enrique