Le dimanche 09 mars 2008 à 20:28 +0700, Frans Thamura a écrit :
> java.lang.ClassNotFoundException:
> org.apache.velocity.runtime.resource.loader.JarResourceLoader

That is really strange - this class is here since a very long time.
Check it is really here in the velocity jar file you are using.

> any idea to make the path /var/www/mysite follow where is my .war ?
>
> this is mine, but i feel stupid with this...
> 
> if we put in /classes we dont need the path, and how can we must put the
> full path when try using .jar

The jar resource loader is meant to reference a jar file that is not in
the classpath - it doesn't now what a webapp is, and that's why it
expects full pathnames. You'd need something like a
WebappJarResourceLoader...  or you can dynamically change the loader url
at startup in some servlet initialization function with something like
this:

    // suppose that 'velocity' is an initialized RuntimeInstance 
    JarResourceLoader jrl = 
(JarResourceLoader)velocity.get("jar.resource.loader.instance");
    if(jrl == null) velocity.getLog().error("******* Cannot find 
JarResourceLoader instance");
    else {
        // put the real path in the config
        String oldpath = velocity.getProperty("jar.resource.loader.path");
        String newpath = "jar:file:" + servletcontext.getRealPath("/") + 
oldpath.substring(8);
        ExtendedProperties props = new ExtendedProperties();
        props.put("path",newpath);
        // reinit the jar resource loader
        jrl.init(props);
    }

Not tested at all!

But before spending energy doing that, why can't you use the classpath
resource loader to fetch templates from cimande-1.3.jar? Since it is
located in /WEB-INF/lib, it appears that this jar IS in your classpath.


  Claude



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to