Google App Engine does not provide a usual file system access. You should implement certain Velocity interfaces to load the files via classloader. I have it working.
On 19 ноя, 22:26, vincwe <vincenzo.amor...@gmail.com> wrote: > Hi to all, > i'm try to use Apache velocity template for mailing, > using the following code > > <code> > VelocityEngine ve = new VelocityEngine(); > try { > ve.setProperty("resource.loader", "file"); > ve.setProperty > ("file.resource.loader.class","org.apache.velocity.runtime.resource.loader.FileResourceLoader"); > > ve.setProperty("file.resource.loader.path","/template/email/"); > ve.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, > "org.apache.velocity.runtime.log.Log4JLogChute" ); > > ve.setProperty("runtime.log.logsystem.log4j.logger", > log.getName()); > // ve.setApplicationAttribute > ("javax.servlet.ServletContext",this.servlet.getServletContext()); > ve.init(); > } catch (Exception e1) { > // TODO Auto-generated catch block > log.warning("EI:"+e1.getMessage()); > } > > VelocityContext context = new VelocityContext(); > Template template = null; > > try > { > template = ve.getTemplate("mail1.vm"); > > } > ..... > > </code> > > But at runtime gives this exception : > > 11-19 10:44AM 33.316 [wincheck123/4.337839622240022599].<stderr>: > [error] ResourceManager.getResource() load exception > W 11-19 10:44AM 33.316 [wincheck123/4.337839622240022599].<stderr>: > access denied (java.io.FilePermission /template/email/mail1.vm read) > W 11-19 10:44AM 33.316 [wincheck123/4.337839622240022599].<stderr>: > java.security.AccessControlException: access denied > (java.io.FilePermission /template/email/mail1.vm > W 11-19 10:44AM 33.316 [wincheck123/4.337839622240022599].<stderr>: at > java.security.AccessControlContext.checkPermission > (AccessControlContext.java:355) > .. > > Are there some security configuration to set for reading files on > appengine? such as security policy or others > > Thank in advance > Regards > Vincenzo -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=.