VelocityEngine unable to find resource file?

Hi! I am leveraging the velocityEngine to do some flat file provisioning and when I try to have it get the file template for a given role stored in a txt file on the IIQ server it generates an error that contains the proper target file path saying “Unable to find resource : filepathUrl”. Now if I take the filepath URL and slap it into a file explorer window the txt file pulls right up. So that being said, I think its more of a configuration issue in my code causing it to not look for the right object type maybe? My current code snip is below:

      VelocityEngine velocityEngine = new VelocityEngine();
      VelocityContext velocityContext = new VelocityContext();

      Properties props = new Properties();
      //props.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
      //props.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
	  props.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
	  props.setProperty("file.resource.loader.path", "C:\\Program Files\\feed\\SER_Templates");
      props.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem");
      velocityEngine.init(props);

               AttributeRequest epicSERTemplate = accountRequest.getAttributeRequest("epicSERTemplate");
               String v_epicSERTemplate = epicSERTemplate.getValue();

               template = velocityEngine.getTemplate("C:\\Program Files\\feed\\SER_Templates\\" + v_epicSERTemplate + ".vm");
1 Like

The code is running under the Application server user, and if this may not be the same as your current authenticated user. Check to see if your Application server is running as a service, and that service user has access to the folder/file you are pointing to.

1 Like