[jcifs] Null pointer exception in ServerMessageBlock.java

Michael B Allen mba2000 at ioplex.com
Wed Jun 21 16:53:21 GMT 2006

Never put your password in the URL. That's a hack for dirty scripts and
developers that just want to test something. Either put your credentials
in a properties file and run the VM like:

  java -Djcifs.properties=beta.prp MyProgram

or better still, create an NPA and pass that to the SmbFile constructor:

  NtlmPasswordAuthentication creds =
      new NtlmPasswordAuthentication("alpha", "beta", "gamma#");
  SmbFile file = new SmbFile(url, creds);

or if you must put your credentials in the URL you must URL encode
any characters reserved for use within URLs. In particular if you
have a '#' or a '%' you need to substitute that with the '%xx'
where 'xx' is the hexadecimal value for that ASCII character like:



On Wed, 21 Jun 2006 10:19:28 -0400
Jake Goulding <goulding at vivisimo.com> wrote:

> I think I have figured this out, and I believe it has to do with the 
> discrepancy of URL and URI and how things get encoded...
> My password has a hash (#) in it. To see what happens, use this test 
> program:
> URL a = new URL("http://alpha;beta:gamma#@delta/foo/bar");

Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization

More information about the jcifs mailing list