velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laredotornado <>
Subject Classpath troubles (ResourceNotFoundException)
Date Mon, 11 Jul 2011 14:12:18 GMT


I'm trying to test something using Velocity 1.6.2 in JUnit 4, but I'm having
trouble getting Velocity to find my email template.  I have verified in the
JUnit test that both my and emailTemplate.vm file can be
found on the classpath, yet I get a "ResourceNotFoundException" on the
'Velocity.getTemplate("email_template.vm");' line of the code below ...

	public void testJob() throws Exception {
		try {
			InputStream stream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("email_template.vm");"stream:" + stream);
			InputStream stream2 =
Thread.currentThread().getContextClassLoader().getResourceAsStream("");"stream2:" + stream2);
			final Template template = Velocity.getTemplate("email_template.vm");

Here is my file

=============Begin =========================
# - example configuration

# uncomment the next two lines to load templates from the
# classpath (WEB-INF/classes)
==============End =========================

Any ideas?  I'm using Maven 3.0.3 and placing the file
in my src/test/resources directory.  The email template file lives in the
same place.  Thanks for any advice, - Dave
View this message in context:
Sent from the Velocity - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message