[jcifs] NullPointerException

eglass1 at comcast.net eglass1 at comcast.net
Fri Jun 4 12:22:05 GMT 2004


> 
> However, I do not manage to get the first example to work and namely
> 
>> java -Djcifs.properties=jcifs.prp -classpath ..\jcifs-0.9.1.jar;. 
> FileInfo
>> smb://O/SQLNET/TNSNAMES.ORA 1
>>            toURL: smb://O/SQLNET/TNSNAMES.ORA
> Exception in thread "main" jcifs.smb.SmbException: Failed to connect to 
> server
> java.net.UnknownHostException: O
>         at jcifs.UniAddress.getByName(UniAddress.java:297)

It looks like you're trying to access the file through your mapped drive
(i.e., you have some shared drive mapped to your local "O:" drive).  If you
want to access the resource using jCIFS, you would need to target the server
directly via an SMB URL.  For example, if "O:" is mapped to the share
"svrshare" on server "myserver", you would do:

    new SmbFile("smb://myserver/svrshare/SQLNET/TNSNAMES.ORA");

If you want to access it using the mapped name (i.e., "O:"), you should be
able to do this with just a normal java.io.File:

    new java.io.File("O:\\SQLNET\\TNSNAMES.ORA");


Eric




More information about the jcifs mailing list