Try this:
p.setProperty( "resource.loader", "file" );
p.setProperty("class.resource.loader.class","org.apache.velocity.runtime.resource.loader.FileResourceLoader" );
p.setProperty("file.resource.loader.path",path);
The path would be the absolute path that you can get from the request.
I am not sure if the order is important or not, but this has worked for me.
It was not easy to finally figure out.