This is the code I have for loading a template from a classpath and
providing it to groovy
InputStream is = TemplateUtils.class.getResourceAsStream(templatePath);
if (is == null)
{
is = ClassLoader.getSystemResourceAsStream(templatePath);
}
return is;
TemplateUtils is my current class.
I want to load the Zip Script template the same way. However it fails with
a class not found error.
The getResource method in ClassPathResourceLoaded needs to be changed to do
the following.
InputStream is =
Thread.currentThread().getContextClassLoader().getResourceAsStream(
getRealPath(path));
if (null == is) {
is = ClassLoader.getSystemResourceAsStream(templatePath);
}
if (null == is) {
throw new ExecutionException("Invalid classpath resource '" +
getRealPath(path), null);
}
return new StreamOnlyResource(is);
}
basically an additional line to try from the system classloader
Original issue reported on code.google.com by roshan...@gmail.com on 10 Jul 2008 at 7:58
Original issue reported on code.google.com by
roshan...@gmail.com
on 10 Jul 2008 at 7:58