Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:50:48+00:00 2026-06-04T17:50:48+00:00

Not able to attach the template for sending the mail.. -servlet.xml <bean id=velocityEngine class=org.springframework.ui.velocity.VelocityEngineFactoryBean>

  • 0

Not able to attach the template for sending the mail..

-servlet.xml

<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
             </value>
        </property>
    </bean>
    <bean id="velocityConfig"
        class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">

        <property name="resourceLoaderPath" value="/"/>

</bean>

    <bean id="velocityviewResolver"
          class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"
          p:prefix="/WEB-INF/velocity/"
          p:suffix=".vm" />
</beans>

code :
The error is pointing to this line which i am using in my Service implementation

String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "mailtemplate", model);

I am getting an error saying not able to find any resource

The complete stack trace of error is:

org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'mailtemplate'
    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)
    at org.springframework.ui.velocity.VelocityEngineUtils.mergeTemplate(VelocityEngineUtils.java:58)
    at org.springframework.ui.velocity.VelocityEngineUtils.mergeTemplateIntoString(VelocityEngineUtils.java:122)
    at service.impl.EmployeeServiceImpl.sendMail(EmployeeServiceImpl.java:110)
    at controllers.TrainingInvitationController.sendMail(TrainingInvitationController.java:54)
    at controllers.TrainingInvitationController$$FastClassByCGLIB$$176c7e66.invoke()
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
    at controllers.TrainingInvitationController$$EnhancerByCGLIB$$b58c7689.sendMail()
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:445)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:356)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
    at org.mortbay.jetty.Server.handle(Server.java:269)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:701)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:617)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
    at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

Now how to resolve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:50:51+00:00Added an answer on June 4, 2026 at 5:50 pm

    I got the answer.. i got an idea from the velocity docs itself..

    I was needed to modify only in velocity bean configuration.. See Below for what i have changed.

    <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
    <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
    </bean>
    

    Thats it… now its working perfect for me..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not being able to attach a MetadataType to a auto generated class in
Im not able to load the page with circlepageindicator. This is the xml <FrameLayout
I am not able to get document.ready event or attach button click event. What
I am having a problem with dynamically loaded views not being able to attach
I am not able to attach the databases in sql express edition with service
Am not able to add events to a id. Though able to attach event
I am not able to flush stdin here, is there a way to flush
I am not able to make a clear decision on this one. I am
I am not able to get my jwysiwyg and Jhtmlarea text editors to work
I am not able to figure out why it is not tracing value for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.