[jcifs] tomcat url unknown protocol: smb

Andreas Panagiotidis andrepan at ethz.ch
Wed Apr 16 16:49:50 GMT 2008


Hello all,

I try to access a samba server using tomcat and I get to popular(?)  
exception of unknown protocol:

java.net.MalformedURLException: unknown protocol: smb
         at java.net.URL.<init>(URL.java:574)
         at java.net.URL.<init>(URL.java:464)
         at java.net.URL.<init>(URL.java:413)
         at movieadmin.user.Console.connectToNas(Console.java:204)


I've already tried to access the smb server with jcifs from a stand- 
alone class and it works perfect.
my system is OSX, Java 6, Tomcat 6.0.16, JCifs 1.2.19

I 've tried using the jcifs.jar in the web-inf/lib, it wasn't working.
Then I've placed it , in $TOMCAT_HOME/lib and remove the jar from the  
"war -> web-inf/lib"

I had the Config.registerSmbURLHandler(); in my code, then I've put   
java.protocol.handler.pkgs=jcifs at the catalina.sh script
I can't figure out the problem, since I see in the output, that the  
property "java.protocol.handler.pkgs" has value jcifs.


Please help!

Andreas Panagiotidis




my code is as follows:

//jcifs.Config.registerSmbURLHandler();

Properties prop = System.getProperties();
System.out.println(prop);

  String value = prop.getProperty("java.protocol.handler.pkgs");
  System.out.println("pkg property value:" + value);

String location = "smb://nas-biol-ibt-1/share-1-$/biol/";


NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",  
"andreas", "password");

try {

    java.net.URL url = new URL(location);

    SmbFile file = new SmbFile(url, auth);
...
}
  
         


More information about the jcifs mailing list