velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Oliver" <ol...@alariussystems.com>
Subject ClasspathResourceLoader no worky
Date Thu, 04 Aug 2005 20:48:37 GMT

I have a JUnit test that I can't seem to get working tieh
ClasspathResourceLoader.

VelocityEngine ve = new VelocityEngine();

ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this);
ve.setProperty(Velocity.RESOURCE_LOADER, "class");
ve.setProperty("class.resource.loader.class","org.apache.velocity.runtime.re
source.loader.ClasspathResourceLoader");
		
VelocityContext context = new VelocityContext();
context.put("username", new String("root"));
context.put("password", new String("letmein"));
		
StringWriter sw = null;
try {
	ve.init();
	sw = new StringWriter();
	Velocity.mergeTemplate("Hibernate_cfg_xml.vm",
Velocity.ENCODING_DEFAULT,context, sw);
} catch (ResourceNotFoundException e) {
	e.printStackTrace();
}

I am running Eclipse 3.0 with JUnit 3.8 and I have the debug runtime
classpath including a jar with the Hibernate_cfg_xml.vm file in several
locations, but whenever I run this test it throws the
ResourceNotFoundException.

I have the template located in the jar at the root and in a couple of
package directories.

I cannot get it to find it.

Is this a problem with the JUnit class loader?

I looked in the debugger and the resourceLoader IS the
ClasspathResourceLoader so I know that part is at least working.




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message