title: Error while loading Velocity template in Spring MVC(org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource)
body: <p>I am getting the 
  org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource error. can some one help me to figure out the issue.I have attached my code below.Any help would be appreciated.Thank you.</p>
  
  <p><a href="https://i.stack.imgur.com/c11eL.png" rel="nofollow noreferrer">I placed the .vm in the class path src folder.</a></p>
  
  <pre><code>Controller look like
  </code></pre>
  
  <p><code>@RequestMapping("/velocity")
      public String velocity(final HttpServletRequest request, final HttpServletResponse response)
      {
          final VelocityEngine ve = new VelocityEngine();
          ve.setProperty("resource.loader", "class");
          ve.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
          ve.init();
          /* next, get the Template */
          final Template t = ve.getTemplate("index.vm");
          /* create a context and add data */
          final VelocityContext context = new VelocityContext();
          context.put("members", "sharat");
          /* now render the template into a StringWriter */
          final StringWriter writer = new StringWriter();
          t.merge(context, writer);
          final String Html = writer.toString();
          return Html;
      }
  </code></p>
  
  <p>spring-servlet.xml</p>
  
  <pre><code>&lt;bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"&gt;
      &lt;property name="resourceLoaderPath" value="/" /&gt;
  &lt;/bean&gt;
  
   &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"&gt;
      &lt;property name="cache" value="true"/&gt;
      &lt;property name="prefix" value=""/&gt;
      &lt;property name="suffix" value=".vm"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'index.vm'
  org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
  org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
  org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
  org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
  org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
  </code></pre>
  
  <p>velocity.properties</p>
  
  <p><code>resource.loader =  class
  file.resource.loader.description = Velocity File Resource Loader
  file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
  file.resource.loader.path = vm
  file.resource.loader.cache = false
  file.resource.loader.modificationCheckInterval = 0</code></p>