java - ResourceNotFoundException on existing path -
i have following class:
public class emailservice { static { velocity.setproperty("resource.loader", "class"); velocity.setproperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.classpathresourceloader"); velocity.init(); } public void sendterminalmoderationstatuschangedemail(terminal terminal, string to) { ... template subjecttemplate = null; try { subjecttemplate = velocity.gettemplate(existedpath, "utf-8"); } catch (urisyntaxexception e) { e.printstacktrace(); } ... } }
in debug see existed path exists. got following error:
unable find resource 'c:/program files (x86)/apache/apache-tomcat-7.0.52/webapps/root/web-inf/classes/velocitytemplates/terminalmoderationstatuschanged.vm'
but file c:/program files (x86)/apache/apache-tomcat-7.0.52/webapps/root/web-inf/classes/velocitytemplates/terminalmoderationstatuschanged.vm
exists on mashine , can navigate if type copied path address line.
instead of using full absolute path, load classpath, because in classes folder.
subjecttemplate = velocity.gettemplate("velocitytemplates/terminalmoderationstatuschanged.vm", "utf-8");
Comments
Post a Comment