FreeMarker (IOException while writing to clientTemplate)

3 messages Options
Embed this post
Permalink
rizzz86

FreeMarker (IOException while writing to clientTemplate)

Reply Threaded More More options
Print post
Permalink
Hi,

I am getting following error while executing my webapp using freemarker:

javax.servlet.ServletException: Error:IOException while writing to clientTemplate firstftl.ftl not found.

From the error it seems that the issue is related to the file path but I have tried all the possibilities to test the path issue but no results. I have placed my .ftl file outside the WEB-INF folder as well as inside the WEb-INF folder but the same error.

Does anyone has the idea of anything that can help me ?

rizzz86
Daniel Dekany

Re: FreeMarker (IOException while writing to clientTemplate)

Reply Threaded More More options
Print post
Permalink
Tuesday, September 29, 2009, 1:34:43 PM, rizzz86 wrote:

>
> Hi,
>
> I am getting following error while executing my webapp using freemarker:
>
> javax.servlet.ServletException: Error:IOException while writing to
> clientTemplate firstftl.ftl not found.
> From the error it seems that the issue is related to the file path but I
> have tried all the possibilities to test the path issue but no results. I
> have placed my .ftl file outside the WEB-INF folder as well as inside the
> WEb-INF folder but the same error.
>
> Does anyone has the idea of anything that can help me ?

You should check how FreeMarker was configured, because there is no
fixed place for templates. It might as well load template from the
class-path, from a database, etc. Where to find the FreeMarker
configuration depends on the framework. Maybe it's in some Spring
container XML, maybe it's in the web.xml, maybe in a .properties file
somewhere... I wouldn't know. Look for something like
"template_loader" or "TemplatePath".

If it's some FreemarkerSerlvet-based solution, then the default is
using the class-path, so you will need something like this in the
web.xml:

<servlet>
  ...
  <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>
  ...
  <init-param>
    <param-name>TemplatePath</param-name>
    <param-value>WEB-INF/templates</param-value>
  </init-param>
  ...
</servlet>


> rizzz86

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
rizzz86

Re: FreeMarker (IOException while writing to clientTemplate)

Reply Threaded More More options
Print post
Permalink
In reply to this post by rizzz86

Thanks for the response and the hint for Templates classpath.

I forgot to set cfg.setDirectoryForTemplateLoading(template) property. Now it is working.

rizzz86

rizzz86 wrote:
Hi,

I am getting following error while executing my webapp using freemarker:

javax.servlet.ServletException: Error:IOException while writing to clientTemplate firstftl.ftl not found.

From the error it seems that the issue is related to the file path but I have tried all the possibilities to test the path issue but no results. I have placed my .ftl file outside the WEB-INF folder as well as inside the WEb-INF folder but the same error.

Does anyone has the idea of anything that can help me ?

rizzz86