You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by petercs <iu...@yahoo.com> on 2012/07/19 19:25:03 UTC

ResourceNotFoundException: Unable to find resource

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.

Re: ResourceNotFoundException: Unable to find resource

Posted by petercs <iu...@yahoo.com>.
I was reading
http://velocity.apache.org/engine/devel/developer-guide.html#Configuring_Resource_Loaders

and it turns out that  ClasspathResourceLoader I am using doesn't requre any
configuration, FileResourceLoader is the one as example that you can set
cache to true

so my orgiinal question is still on, why VelocityEngine fails to load the
template after few thousands of emails being successfully sent.


any more ideas?

Thanks,
peter


petercs wrote:
> 
> LOL no you are not helping a spammer
> 
> what I also tried to send one email per second over long time, eventually
> velocity will crash, so even if you send few emails, things will go bad at
> some point unless you restart your application server which most do new
> deployment every few months or so.
> 
> any ways I tried 
> 
> velocity.engine.resource.manager.cache.enabled=true 
> 
> and that let it go to 150K but then it froze
> 
> I'll go over docs and see if this is right caching.
> 
> thanks for your replies.
> 
> 
> 
> Marnix Bindels-2 wrote:
>> 
>> I know, it does not make a lot of sense but on the other hand it is very
>> easy to try and verify. I am sorry, but don't know the exact syntax for
>> setting the caching but the docs should help you on your way.
>> 
>> Again, it's a long shot... But I recently had a caching should be on in
>> production experience in Velocity 1.7 where theoretically speaking it
>> should not make a difference
>> 
>> Cheers,
>>    Marnix
>> 
>> P.s. I hope I am not helping the king of spam... 60k emails...
>> 
>> 
>> 
>> Op 19 jul. 2012 om 20:55 heeft "petercs" <iu...@yahoo.com> het volgende
>> geschreven:
>> 
>>> 
>>> 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" <iu...@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-unsubscribe@velocity.apache.org
>>>>> For additional commands, e-mail: dev-help@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-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: dev-help@velocity.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: dev-help@velocity.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ResourceNotFoundException%3A-Unable-to-find-resource-tp34185867p34187069.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: ResourceNotFoundException: Unable to find resource

Posted by petercs <iu...@yahoo.com>.
LOL no you are not helping a spammer

what I also tried to send one email per second over long time, eventually
velocity will crash, so even if you send few emails, things will go bad at
some point unless you restart your application server which most do new
deployment every few months or so.

any ways I tried 

velocity.engine.resource.manager.cache.enabled=true 

and that let it go to 150K but then it froze

I'll go over docs and see if this is right caching.

thanks for your replies.



Marnix Bindels-2 wrote:
> 
> I know, it does not make a lot of sense but on the other hand it is very
> easy to try and verify. I am sorry, but don't know the exact syntax for
> setting the caching but the docs should help you on your way.
> 
> Again, it's a long shot... But I recently had a caching should be on in
> production experience in Velocity 1.7 where theoretically speaking it
> should not make a difference
> 
> Cheers,
>    Marnix
> 
> P.s. I hope I am not helping the king of spam... 60k emails...
> 
> 
> 
> Op 19 jul. 2012 om 20:55 heeft "petercs" <iu...@yahoo.com> het volgende
> geschreven:
> 
>> 
>> 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" <iu...@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-unsubscribe@velocity.apache.org
>>>> For additional commands, e-mail: dev-help@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-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: dev-help@velocity.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ResourceNotFoundException%3A-Unable-to-find-resource-tp34185867p34186921.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: ResourceNotFoundException: Unable to find resource

Posted by Marnix Bindels <Ma...@zorgttp.nl>.
I know, it does not make a lot of sense but on the other hand it is very easy to try and verify. I am sorry, but don't know the exact syntax for setting the caching but the docs should help you on your way.

Again, it's a long shot... But I recently had a caching should be on in production experience in Velocity 1.7 where theoretically speaking it should not make a difference

Cheers,
   Marnix

P.s. I hope I am not helping the king of spam... 60k emails...



Op 19 jul. 2012 om 20:55 heeft "petercs" <iu...@yahoo.com> het volgende geschreven:

> 
> 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" <iu...@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-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: dev-help@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-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: ResourceNotFoundException: Unable to find resource

Posted by petercs <iu...@yahoo.com>.
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" <iu...@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-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: dev-help@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-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: ResourceNotFoundException: Unable to find resource

Posted by petercs <iu...@yahoo.com>.

Marmix, 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" <iu...@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-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ResourceNotFoundException%3A-Unable-to-find-resource-tp34185867p34186163.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: ResourceNotFoundException: Unable to find resource

Posted by Marnix Bindels <Ma...@zorgttp.nl>.

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" <iu...@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-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org