2

I have the following issus :

In my web app, one of the jar must be in the tomcat5.5 $CLASSPATH , and not like the other in WEBAPP/lib.

i put it in the tomcatdir/server/lib. ( and then in tomcatdir/common/lib ). With no success.

If the jar is not loaded by the System loader ( java ), i can't use all the feature provide by the jar.

Instaciate a variable of type URL with a scheme of type "smb" to be exact.

In fact, i'm trying to do the following :

http://jcifs.samba.org/src/docs/faq.html#ukproto

Anyone with the same issue ? with more experience in tomcat ?

Thanks

Antoine

a.claval
  • 89
  • 1
  • 10

2 Answers2

1

The solution is in two part :

  1. Add the jcifs jar to the tomcat classpath manually ( by explicitely add the absolute path to /ect/init.d/tomcat5.5 ) .

  2. also set the following java System property :

- java.protocol.handler.pkgs=jcifs To do that have two choose

  • Do it your source code, at the application lauch by exemple.

    Properties prop = System.getProperties();
    prop.setProperty("java.protocol.handler.pkgs", "jcifs");
    
  • Or java -Djava.protocol.handler.pkgs=jcifs at the lauch or TOMCAT ( not the application ). See the tomcat launch script, a variable is means for that. ( JAVA_OPT )

a.claval
  • 89
  • 1
  • 10
0

If you've confirmed that it's not being loaded into your classpath (ie via a debugger or some other method), you may have to put it in the $JDK_HOME/jre/lib directory to ensure that the System classloader loads it with the VM.

Alternatively, if you want access to a CIFS file system, you can use the Apache Commons VFS project. It's a wrapper to a number of different file systems and I've used it to great success in a number of my own past projects. I've never had any difficulty just placing it in the $CATALINA_HOME/common/lib directory (where $CATALINA_HOME is your Tomcat directory). Though I should warn you that the CIFS module is in incubation currently.

Alex Marshall
  • 241
  • 1
  • 3
  • 10
  • From my understanding, putting jcifs.jar in $CATALINA_HOME/common/lib should do the tricks. But nop. I will try in JDK_HOME/jre/lib, but i'm pretty sure it will not work as the launch script of tomcat redefine the classpath ( startup.sh who calls setclasspath.sh ) – a.claval Sep 23 '09 at 08:05
  • If the classpath has been redefined, that's quite possibly why your .jar file isn't being read from $CATALINA_HOME/common/lib. Are there other jars in that folder that you can confirm aren't being loaded into the classpath ? There should be some jars in there that come with Tomcat, which Tomcat requires to run. If they're not being loaded from there, they must be loaded somewhere else, try to find where that is and put the jcifs.jar file in the same folder, or otherwise put it somewhere that is on the defined classpath. – Alex Marshall Sep 23 '09 at 20:56