Reputation: 3809
I'm getting a ResourceNotFound
exception with Velocity trying to use the #parse
directive (and getting the same thing with #include
). I know that my ClassPathResourceLoader
is configured correctly, because if I remove the #parse
directive, the templates render fine. The template that I'm trying to include is in the same jar file as the template that's rendering correctly, so it's not a location issue, either.
I know from the Velocity docs that templates must be in TEMPLATE_ROOT
and that you can also register both a FileResourceLoader
and a ClasspathResourceLoader
. I've tried both to no avail.
I find it hard to believe that you cannot use #include
or #parse
with the ClasspathResourceLoader
, but I've tried everything I can think of. Any help is greatly appreciated.
Upvotes: 1
Views: 1672
Reputation: 1296
alternatively, you can add the following to your velocity.properties to enable Relative Paths:
eventhandler.include.class = org.apache.velocity.app.event.implement.IncludeRelativePath
Upvotes: 4
Reputation: 3809
Ok, I got it working. Even though the other template files being included in the #parse
directive were in the same directory as the template containing the #parse
directive, I needed to add the path (relative to the root of the jar file) to them.
Upvotes: 1