Loading Velocity Template in a WebSphere Portlet application
===

I am trying to load a velocity template content into my IBM WebSphere 7.0(JSR 286 - Basic) Portal Application, in order to send a mail. But the problem is when i try to run the VelocityLoader as a standalone code its working but when i deploy the same in WPS7.0, i am getting 'Unable to find the resource' exception.

Code Snippet:

    public String formEmailContent(final String userId, final String tempPwd,
			final ActionRequest aReq, final ActionResponse aResp) {
		final String vmTemplateLoc = aResp.encodeURL(aReq.getContextPath()
				+ "/velocity/html/email.vm");
		final StringWriter w = new StringWriter();
		try {

			final VelocityContext context = new VelocityContext();

			context.put(USER_NAME_VM, userId);
			context.put(TEMP_PWD_VM, tempPwd);

			// Rendering the template
			Velocity.mergeTemplate(vmTemplateLoc, context, w);
			LOGGER.debug("Final Mail Content : " + w.toString());
		} catch (Exception e) {
			LOGGER.error("Exception in formingEmailContent: " + e.getMessage());
		}
		return w.toString();
	}
}

Your help is highly appreciated.

Thanks,
Harry