title: ResourceManager : unable to find resource 'emailTemplate.vm' in any resource loader
body: <p>I am doing an application in springs with maven. i wrote all properties in app.properties  file </p>
  
  <p>file structure is like this</p>
  
  <pre><code>                         src/main/resource
  
                               |_
                               |   templates
                               |        |_mytempaltefile.vm    
                               |_ app.properties         
  </code></pre>
  
  <p>i gave the path(absloute) in app.property </p>
  
  <p>app.properties file</p>
  
  <pre><code>template.base.path=D\:/SVN/trunk/tfbdirect/src/main/resources/templates
  </code></pre>
  
  <p>utilities-spring.xml</p>
  
  <pre><code>&lt;bean id="velocityEngine"
      class="org.springframework.ui.velocity.VelocityEngineFactoryBean"&gt;
      &lt;property name="velocityProperties"&gt;
          &lt;props&gt;
              &lt;prop key="resource.loader"&gt;file&lt;/prop&gt;
              &lt;prop key="file.resource.loader.class"&gt;
                  org.apache.velocity.runtime.resource.loader.FileResourceLoader
              &lt;/prop&gt;
              &lt;prop key="file.resource.loader.path"&gt;${template.base.path}&lt;/prop&gt;
              &lt;prop key="file.resource.loader.cache"&gt;false&lt;/prop&gt;
          &lt;/props&gt;
         &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>my class</p>
  
  <pre><code> import java.util.HashMap;
   import java.util.Map;
   import org.apache.velocity.app.VelocityEngine;
   import org.springframework.ui.velocity.VelocityEngineUtils;
   import com.providerpay.tfbdirect.service.mail.MailSenderService;
  
   public class LoginServiceImpl implements ILoginService{
  
  /**
   * Injected through Spring IOC
   */
  ILoginDAO loginDAO;
  ClaimRuleProcessServiceImpl claimRuleProcessServiceImpl;
  PlatformTransactionManager txmanager;
  
  //IForgotPasswordDAO forgotPasswordDAO;
  
  private VelocityEngine velocityEngine;
  
  private String appURL;
  private MailSenderService mailSenderService;
  
  
  
  
  TFBLogger log = TFBLoggerFactory.getLogger(RuleServer.class);
  
  
  
  public String getAppURL() {
      return appURL;
  }
  
  public void setAppURL(String appURL) {
      this.appURL = appURL;
  }
  
  public MailSenderService getMailSenderService() {
      return mailSenderService;
  }
  
  public VelocityEngine getVelocityEngine() {
      return velocityEngine;
  }
  
  
  public void setVelocityEngine(VelocityEngine velocityEngine) {
      this.velocityEngine = velocityEngine;
  }
  
  public void setMailSenderService(MailSenderService mailSenderService) {
      this.mailSenderService = mailSenderService;
  }
  
  public ILoginDAO getLoginDAO() {
      return loginDAO;
  }
  public void setLoginDAO(ILoginDAO loginDAO) {
      this.loginDAO = loginDAO;
  }
  public ClaimRuleProcessServiceImpl getClaimRuleProcessServiceImpl() {
      return claimRuleProcessServiceImpl;
  }
  public void setClaimRuleProcessServiceImpl(
          ClaimRuleProcessServiceImpl claimRuleProcessServiceImpl) {
      this.claimRuleProcessServiceImpl = claimRuleProcessServiceImpl;
  }   
  public void setTxmanager(PlatformTransactionManager txmanager) {
      this.txmanager = txmanager;
  }
  
  
  
  /**
   * Validates Login
   * @param loginView
   * @return
   */
  public boolean isValidLogin(LoginView loginView) {
  
      /* create tx definition object */
      DefaultTransactionDefinition paramTransactionDefinition = new     DefaultTransactionDefinition();
      TransactionStatus status = txmanager.getTransaction(paramTransactionDefinition );
      boolean result = false;
  
      try{
          LoginEntity loginEntity = BeanMapper.INSTANCE.viewToEntityMapper(loginView);
          Feedback feedback = claimRuleProcessServiceImpl.validateClaimEligibility(loginEntity);
          log.info( "Rule executed was " +feedback.getAll());
  
          for (FeedbackMessage feedbackmessaage :feedback.getAll())
          {
              log.info("\n--------------");
              log.info(feedbackmessaage.getRuleCd());
              log.info(feedbackmessaage.getMessage());
              log.info(feedbackmessaage.getSeverity().getName());
              log.info("\n--------------");
          }
  
          result = loginDAO.isValidLogin(loginEntity);
          log.debug("result = {}", result);
  
          txmanager.commit(status);
  
      }catch(Exception e){
          txmanager.rollback(status);
          throw new TfbException("Error occured while validating login credentials");
      }
  
      return result; 
  }
  
  
  
  
  @Autowired
  VelocityEngine velocityengine;
  public boolean mailResetLink(LoginView loginView) {
  
      String toEmailAddress;
      LoginEntity loginEntity = BeanMapper.INSTANCE.viewToEntityMapper(loginView);
  
      /* getting user Email from DAO*/
      toEmailAddress = loginDAO.getEmailByUsername(loginEntity);
  
      if(toEmailAddress != null &amp;&amp; toEmailAddress.trim().length() &gt; 0)
      {
          Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;();
          model.put("user", loginEntity);
          model.put("appURL", appURL);
          String body = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "emailTemplate.vm","UTF-8", model);
  
          mailSenderService.sendMail("from mail", toEmailAddress, "Password Reset Link",body);
  
  
      }
      else
      {
          return false;
      }
      return true;
  }
  
  public boolean resetPassword(LoginView loginView) 
  {
  
      LoginEntity loginEntity = BeanMapper.INSTANCE.viewToEntityMapper(loginView);
  
      return loginDAO.resetPassword(loginEntity);
  }
  }
  </code></pre>
  
  <p>every thing fine but i need to change the absolute path to relative path.. i tried many   ways.</p>
  
  <p>i tried like following</p>
  
  <pre><code>template.base.path=/templates/
  </code></pre>
  
  <p>but still getting below error .</p>
  
  <p>ResourceManager : unable to find resource 'emailTemplate.vm' in any resource loader.</p>
  
  <p>can any one help me..</p>
  
  <p>Thanks in advance</p>