I was just thinking about your comment. I do have only 10 templates, and so I think I don't need caching unless velocity is not able to clear already loaded templates after finish using it.
petercs wrote: > > Marnix, this is a great hint! I am using the default , how to enable it? > is adding > velocity.engine.resource.manager.cache.enabled=true ? > > <bean id="velocityEngine" > class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> > <property name="velocityProperties"> > <value> > resource.loader=class > > class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader > velocity.engine.resource.manager.cache.enabled=true > </value> > </property> > </bean> > > > Marnix Bindels-2 wrote: >> >> >> >> Can you verify whether resource caching is enabled? It's off by default, >> to my experience >> >> Cheers, >> Marnix >> >> Op 19 jul. 2012 om 19:25 heeft "petercs" <iun...@yahoo.com> het volgende >> geschreven: >> >>> >>> Hi, >>> >>> I am using velocity to generate emails out of templates. the email >>> generation goes fine for a while but after sending like 50k-60K >>> successful >>> emails I then start on getting : >>> >>> Caused by: org.apache.velocity.exception.ResourceNotFoundException: >>> Unable >>> to find resource 'mail/velocity/badDisconnectEmail.vm' >>> at >>> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483) >>> at >>> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354) >>> at >>> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400) >>> at >>> org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:370) >>> at >>> org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:345) >>> >>> so the weird thing that the email is generated which means the template >>> is >>> there, but after a while veloicity is not able to load any longer. >>> >>> >>> here is some details on how I use it: >>> >>> 1- using spring framework to create >>> >>> >>> >>> >>> resource.loader=class >>> >>> class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> 2- EmailUtilsImpl >>> >>> import org.apache.velocity.app.VelocityEngine; >>> import org.springframework.ui.velocity.VelocityEngineUtils; >>> import java.util.Map; >>> >>> public class EmailUtilsImpl { >>> >>> private VelocityEngine velocityEngine; >>> >>> public void setVelocityEngine(VelocityEngine velocityEngine) >>> { >>> this.velocityEngine = velocityEngine; >>> } >>> >>> public String mergeTemplateIntoString(String emailTemplate, Map >>> model) >>> throws Exception >>> { >>> String text = VelocityEngineUtils.mergeTemplateIntoString( >>> velocityEngine, emailTemplate, model); >>> return text; >>> } >>> } >>> >>> >>> 3- I am using velocity 1.6.2 and spring framework 2.5.6 >>> >>> 4- the packaged war has the templates under >>> WEB-INF/classes/mail/velocity/*.vm >>> >>> Thanks, >>> Peter >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/ResourceNotFoundException%3A-Unable-to-find-resource-tp34185867p34185867.html >>> Sent from the Velocity - Dev mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org >> For additional commands, e-mail: dev-h...@velocity.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/ResourceNotFoundException%3A-Unable-to-find-resource-tp34185867p34186311.html Sent from the Velocity - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org