I have a written library in which there is a postal part. This postal part uses the use of Velocity. The mailbuilder class is as follows:
public class mailBuilder { public void initialize() throws Exception { Properties props = new Properties(); log.info("About to set the ClassPath for Velocity specific tasks"); props.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath"); props.setProperty("classpath." + VelocityEngine.RESOURCE_LOADER + ".class", ClasspathResourceLoader.class.getName()); try { log.info("Just before"); Velocity.init(props); log.info("Just after"); } catch ( Exception e ) { log.error( "Caught Execption on velocityEngine init", e ); throw new Exception( "Caught Execption on velocityEngine init", e ); } log.info("Completed initializing Velocity Engine"); } public String returnMailstring() throws Exception { initialize(); .... .... } }
Now, when I run and test this library, as it comes from eclipse, the results look as expected, and everything seems to be fine. I have a web application that accepts a request from the user interface and uses ExecutorService (newSingleThreadExecutor) to serve these user requests one by one in the background.
I notice that my calls to the aforementioned library were hung up on the mailbuilding part specifically in Velocity.init(props) An exception was thrown, but the thread seems to freeze when initializing VelocityEngine. I looked online and had no luck with what could be the problem. Any help on how the problem would be huge.
Thanks P1nG
source share