[jcifs] java.net.MalformedURLException: unknown protocol: smb

Michael B. Allen miallen at eskimo.com
Fri Dec 13 07:19:33 EST 2002


Please send all messages to the jcifs mailing list.

On Thu, 12 Dec 2002 16:13:43 -0000
"Stent, Adrian" <Adrian.Stent at kemira.com> wrote:

> Thanks for that, placing the jar file in the lib/ext worked fine.
> 
> I was wondering if I could ask another question? 
> 
> I have been going through the archives for the last year but couldn't see
> anything in the way of ways to use the syntax for SmbFile as I keep getting
> access denied which means my authentication is not correct.

Do you mean the SMB URL syntax? See the API documentation for SmbFile.

> Manually this works connecting to the c$ of an NT workstaion
> 
> NET USE /PERSISTENT:NO q: \\incsql\c$ /USER:incsql\administrator password
> 
> Trying to get that to work with SmbFile has been a mission for a newbie like
> me.
> 
> I have tried various combinations based around: 
> 
> smbfile = new SmbFile("smb://incsql//administrator:password@incsql/c$/");

This is not valid. Perhaps you can try:

smbfile = new SmbFile("smb://incsql;administrator:password@incsql/c$/");

But this looks like you're trying to use the local machine name as the
authenticating domain meaning you are doing a local login. I'm not sure
how that will work with jCIFS. Also you might try other smbclients like
smbclient from Samba or smbfs from Linux if it's available.

> I have tried the domain as the actual NT domain, incsql as the domain and no
> domain; along with missing out the incsql in front of the username.

This has nothing to do with jCIFS. Natrually, you'll need to find out
from your network administrator what the appropriate credentials are.

> 
> If you have any pointers on how I can get this going that would be great.
> 
> I am running JVM 1.4 SDk on a Win2k workstation.
> 
> Thanks
> 
> Adrian
> 
> 
> PS not sure if I was meant to reply to you or the mail list.
> 
> -----Original Message-----
> From: Michael B. Allen [mailto:miallen at eskimo.com] 
> Sent: 11 December 2002 21:18
> To: jcifs at lists.samba.org
> Cc: Stent, Adrian
> Subject: Re: [jcifs] java.net.MalformedURLException: unknown protocol: smb
> 
> I'm busily trying to update the FAQ. For now, see the mailing list
> archives and recent messages by Eric.
> 
> Attaching FAQ.html for further editing at work. I'll try to update it
> and get out jcifs-0.7.0b10 with the approriate changes to help with
> this issue.
> 
> On Wed, 11 Dec 2002 14:20:39 -0000
> "Stent, Adrian" <Adrian.Stent at kemira.com> wrote:
> 
> >  
> > I am trying to connect to a remote NT workstation using SmbFile, but come
> up
> > with an unknown protocol Exception.
> > "java.net.MalformedURLException: unknown protocol: smb"
> >  
> > The line that throws the exception is:
> > smbfile = new
> >
> SmbFile("smb:\\incmachine;\\incmachine\\administrator:password!@incsql/c/");

Wow. The above URL will definately not work. In short the syntax is:

  smb://domain;user:pass@server/share/path/to/file

Trailing slashes for directories is required.

> >  
> > normally manually accessing a machine we use:
> > NET USE /PERSISTENT:NO q: \\machinename\c$ /USER:machinename\administrator
> > password
> >  
> > I have put the jcifs-0.7.0b9.jar in the same dir as the rest of my class
> > files.
> >  
> >  
> >  
> > My aim is to go through a list of NT workstations checking to see if a
> > directory exists in a NT4 server environment. 
> >  
> > Appreciate any feedback.
> >  
> > Adrian

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 



More information about the jcifs mailing list