[jcifs] Null pointer exception in ServerMessageBlock.java

Jake Goulding goulding at vivisimo.com
Tue Jun 20 19:09:13 GMT 2006


At line 212 of ServerMessageBlock.java, I get a Null Pointer Exception, 
and I was hoping someone could help me figure it out.

I am using the ACL resolve patch found in the patches directory as I 
strongly need the ability to get the usernames and groups for each file. 
When I run it normally, I get the following exception:
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad 
password.
        at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:499)
        at jcifs.smb.SmbTransport.send(SmbTransport.java:610)
        at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:269)
        at jcifs.smb.SmbSession.send(SmbSession.java:225)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:147)
        at jcifs.smb.SmbFile.connect(SmbFile.java:792)
        at jcifs.smb.SmbFile.connect0(SmbFile.java:762)
        at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:72)
        at 
jcifs.smb.TransactNamedPipeInputStream.<init>(TransactNamedPipeInputStream.java:38)
        at 
jcifs.smb.SmbNamedPipe.getNamedPipeInputStream(SmbNamedPipe.java:166)
        at jcifs.smb.RpcTransport.attach(RpcTransport.java:91)
        at rpc.Stub.attach(Stub.java:105)
        at rpc.Stub.call(Stub.java:110)
        at jcifs.rpc.LsaRPC.openPolicy(LsaRPC.java:62)
        at jcifs.rpc.LsaRPC.lookupSids(LsaRPC.java:94)
        at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2528)

Which I believe is the same problem as discussed here (guest account 
being used): 
http://thread.gmane.org/gmane.network.samba.java/5273/focus=5304

However, if I set the properties jcifs.smb.client.{domain, username, 
password} before calling the appropriate functions I get this error:
Exception in thread "main" java.lang.NullPointerException
        at 
jcifs.smb.ServerMessageBlock.writeString(ServerMessageBlock.java:212)
        at 
jcifs.smb.ServerMessageBlock.writeString(ServerMessageBlock.java:201)
        at 
jcifs.smb.SmbComNTCreateAndX.writeBytesWireFormat(SmbComNTCreateAndX.java:170)
        at 
jcifs.smb.AndXServerMessageBlock.writeAndXWireFormat(AndXServerMessageBlock.java:101)
        at 
jcifs.smb.AndXServerMessageBlock.encode(AndXServerMessageBlock.java:65)
        at jcifs.smb.SmbTransport.doSend(SmbTransport.java:402)
        at jcifs.util.transport.Transport.sendrecv(Transport.java:70)
        at jcifs.smb.SmbTransport.send(SmbTransport.java:602)
        at jcifs.smb.SmbSession.send(SmbSession.java:231)
        at jcifs.smb.SmbTree.send(SmbTree.java:102)
        at jcifs.smb.SmbFile.send(SmbFile.java:688)
        at jcifs.smb.SmbFile.open0(SmbFile.java:828)
        at jcifs.smb.SmbFile.open(SmbFile.java:846)
        at 
jcifs.smb.TransactNamedPipeOutputStream.write(TransactNamedPipeOutputStream.java:61)
        at jcifs.smb.RpcTransport.send(RpcTransport.java:107)
        at 
rpc.DefaultConnection.transmitFragment(DefaultConnection.java:107)
        at rpc.DefaultConnection.transmit(DefaultConnection.java:51)
        at 
rpc.ConnectionOrientedEndpoint.send(ConnectionOrientedEndpoint.java:140)
        at 
rpc.ConnectionOrientedEndpoint.connect(ConnectionOrientedEndpoint.java:160)
        at 
rpc.ConnectionOrientedEndpoint.bind(ConnectionOrientedEndpoint.java:134)
        at 
rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:67)
        at rpc.Stub.call(Stub.java:113)
        at jcifs.rpc.LsaRPC.openPolicy(LsaRPC.java:62)
        at jcifs.rpc.LsaRPC.lookupSids(LsaRPC.java:94)
        at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2528)

Using JSwat, I can see that indeed, str is null in that call, but my 
lack of knowledge of the library prevents me from figuring out what is 
going wrong and where. Any help would be much appreciated!

-- 
Jake Goulding
Software Engineer
Vivísimo, Inc.

"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."



More information about the jcifs mailing list