You can get odd behavior with 1.4 when running Velocity from a jar outside of the application classpath. For example, having the velocity jar in a container while the calling app is in a webapp.
We've fixed this with upcoming release 1.5 (download the beta http://people.apache.org/dist/jakarta/velocity/v1.5beta1/ ). Now it searches for all plugins, templates etc in the ThreadContext classpath first. The result is much more intuitive behavior in these type of circumstances. WILL On 10/23/06, Robby Walker <[EMAIL PROTECTED]> wrote:
Hi, I have a project using Velocity 1.4 that I'm working on from Eclipse 3.2.1. In my project path I have a directory called 'lib' which contains velocity-dep-1.4.jar. I have velocity-dep-1.4.jar added as an external jar to my project (I've also tried as a non-external jar). I'm using the following velocity.properties: resource.loader = classpath classpath.resource.loader.description = Velocity Classpath Resource Loader classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader When I run init(...) from org.apache.velocity.app.Velocity I get the following error: java.lang.Exception: Problem initializing template loader: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader Error is: java.lang.ClassNotFoundException: org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:41) at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:142) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:227) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461) at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:208) at org.apache.velocity.app.Velocity.init(Velocity.java:106) at com.ctk.index.AirsIndexer.<init>(AirsIndexer.java:75) at com.ctk.index.AirsParser.main(AirsParser.java:62) at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:56) at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:142) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:227) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461) at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:208) at org.apache.velocity.app.Velocity.init(Velocity.java:106) at com.ctk.index.AirsIndexer.<init>(AirsIndexer.java:75) at com.ctk.index.AirsParser.main(AirsParser.java:62) But here is the strange part. In my main function if I call Class.forName("org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader") it works and loads the class. Even if I call Class.forName before Velocity.init, I still get the error. I know this could be something pretty simple or fundamental I'm missing. Any help is greatly appreciated. Additional info: Windows XP JRE 1.5_09 Thank you, Robby Walker --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]