Hi,
I am using the velocity template engine to do message customization at
run-time, inside a portlet application.
In my code, both class loading and jar loading are implemented. The code to
set properties for class loading and templating the message is like:

           p.setProperty("resource.loader", CLASS_LOADER);
           p.setProperty("class.resource.loader.description", "Velocity
Classpath Resource Loader");
           p.setProperty("class.resource.loader.class", "
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");

           Velocity.init( p );
           VelocityContext context = new VelocityContext();

           // context setting
           Iterator it = tempNameValues.keySet().iterator();
           while (it.hasNext()) {
               String key = (String)it.next();
               context.put( key, tempNameValues.get(key));
               if(log.isDebugEnabled()) {
                   log.debug("key: " + key + "; value: " +
tempNameValues.get(key) );
               }
           }

           // template translation
           StringWriter sw = new StringWriter();
           Template template = Velocity.getTemplate(tempFile);



For most of the time, it works fine. But sometime it does not work and we
got exception:

ResourceNotFoundException: Unable to find resource ....

It works always fine in my local development environment, but it happens
sometime in QA env and production env after a new code deployment. What is
the problem? need help.


Thanks!!

Reply via email to