You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Andy Frost <An...@valtech.com> on 2001/02/26 16:15:09 UTC

FW: Problem finding templates in Forumdemo

In trying to run the velocity forumdemo as distributed (20010223 build), the
ControllerServlet could not find the templates.   .

> I made two observations:
> 1)  There is no org.apache.velocity.runtime.loader.FileTemplateLoader
> class in the 20010223 distribution.  Should there be?
> 2)  It appears that the FileResourceLoader is using the
> resource.loader.1.resource.path default property rather than the
> template.path property listed in the velocity.properties file specified by
> the web.xml config file.
> 
> I fixed the problem by adding the following line to the
> velocity.properties file:
> resource.loader.1.resource.path=C://jakarta-tomcat-3.2.1/webapps/forumdemo
> /template
> 
> I don't know what other resources the forumdemo app might need to load, so
> I don't know what kind of adverse side effects this might have had.  I am
> deploying to Tomcat 3.2.1 running on Windows 2000.  
> 
> The following entries were in the velocity log (attached):
> 
> ############################
> Fri Feb 23 11:19:43 CST 2001   [info] Default Properties File:
> org\apache\velocity\runtime\defaults\velocity.properties
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> runtime.log = C://jakarta-tomcat-3.2.1/webapps/forumdemo/logs/velocity.log
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.loader = org.apache.velocity.runtime.loader.FileTemplateLoader
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> counter.initial.value = 1
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> counter.name = velocityCounter
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.path = C://jakarta-tomcat-3.2.1/webapps/forumdemo/template
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> default.contentType = text/html
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.modificationCheckInterval = 2
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.asciihack = false
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.encoding = UTF8
> Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> template.cache = false
> Fri Feb 23 11:19:43 CST 2001   [info] Log file being used is:
> C:\jakarta-tomcat-3.2.1\webapps\forumdemo\logs\velocity.log
> . . .
> Fri Feb 23 11:19:43 CST 2001   [info] Attempting to find list.vm with
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> Fri Feb 23 11:19:43 CST 2001  [error] FileResourceLoader Error: cannot
> find resource C:\jakarta-tomcat-3.2.1\bin\.\list.vm
> Fri Feb 23 11:19:43 CST 2001  [error] java.lang.Exception: Can't find
> list.vm!
> ############################
> 
> And the following is from
> org/apache/velocity/runtime/defaults/velocity.properties (also attached)
> ############################
> #-------------------------------------------------------------------------
> ---
> # T E M P L A T E  L O A D E R S
> #-------------------------------------------------------------------------
> ---
> # 
> # 
> #-------------------------------------------------------------------------
> ---
> 
> resource.loader.1.public.name = File
> resource.loader.1.description = Velocity File Resource Loader
> resource.loader.1.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> resource.loader.1.resource.path = .
> resource.loader.1.cache = false
> resource.loader.1.modificationCheckInterval = 2
> ############################
> 
> 
> 
> 
> 
> 
>  <<velocity.log>> 

Re: FW: Problem finding templates in Forumdemo

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Andy Frost wrote:
> 
> In trying to run the velocity forumdemo as distributed (20010223 build), the
> ControllerServlet could not find the templates.   .
> 


> > I made two observations:
> > 1)  There is no org.apache.velocity.runtime.loader.FileTemplateLoader
> > class in the 20010223 distribution.  Should there be?
> > 2)  It appears that the FileResourceLoader is using the
> > resource.loader.1.resource.path default property rather than the
> > template.path property listed in the velocity.properties file specified by
> > the web.xml config file.

Yes, that would be a problem.  Sorry about that.  I thought we got
everything when we made that change.

1) no, it is now o.a.v.r.resource.loader.FileResourceLoader

2) yes : you got that right too.

Is it working?  I will go through this tonight to ensure that it works,
and put better docs...

geir


> >
> > I fixed the problem by adding the following line to the
> > velocity.properties file:
> > resource.loader.1.resource.path=C://jakarta-tomcat-3.2.1/webapps/forumdemo
> > /template
> >
> > I don't know what other resources the forumdemo app might need to load, so
> > I don't know what kind of adverse side effects this might have had.  I am
> > deploying to Tomcat 3.2.1 running on Windows 2000.
> >
> > The following entries were in the velocity log (attached):
> >
> > ############################
> > Fri Feb 23 11:19:43 CST 2001   [info] Default Properties File:
> > org\apache\velocity\runtime\defaults\velocity.properties
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > runtime.log = C://jakarta-tomcat-3.2.1/webapps/forumdemo/logs/velocity.log
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.loader = org.apache.velocity.runtime.loader.FileTemplateLoader
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > counter.initial.value = 1
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > counter.name = velocityCounter
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.path = C://jakarta-tomcat-3.2.1/webapps/forumdemo/template
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > default.contentType = text/html
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.modificationCheckInterval = 2
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.asciihack = false
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.encoding = UTF8
> > Fri Feb 23 11:19:43 CST 2001   [info]    ** Property Override :
> > template.cache = false
> > Fri Feb 23 11:19:43 CST 2001   [info] Log file being used is:
> > C:\jakarta-tomcat-3.2.1\webapps\forumdemo\logs\velocity.log
> > . . .
> > Fri Feb 23 11:19:43 CST 2001   [info] Attempting to find list.vm with
> > org.apache.velocity.runtime.resource.loader.FileResourceLoader
> > Fri Feb 23 11:19:43 CST 2001  [error] FileResourceLoader Error: cannot
> > find resource C:\jakarta-tomcat-3.2.1\bin\.\list.vm
> > Fri Feb 23 11:19:43 CST 2001  [error] java.lang.Exception: Can't find
> > list.vm!
> > ############################
> >
> > And the following is from
> > org/apache/velocity/runtime/defaults/velocity.properties (also attached)
> > ############################
> > #-------------------------------------------------------------------------
> > ---
> > # T E M P L A T E  L O A D E R S
> > #-------------------------------------------------------------------------
> > ---
> > #
> > #
> > #-------------------------------------------------------------------------
> > ---
> >
> > resource.loader.1.public.name = File
> > resource.loader.1.description = Velocity File Resource Loader
> > resource.loader.1.class =
> > org.apache.velocity.runtime.resource.loader.FileResourceLoader
> > resource.loader.1.resource.path = .
> > resource.loader.1.cache = false
> > resource.loader.1.modificationCheckInterval = 2
> > ############################
> >
> >
> >
> >
> >
> >
> >  <<velocity.log>>
> 
>   ------------------------------------------------------------------------
>                    Name: velocity.log
>    velocity.log    Type: unspecified type (application/octet-stream)
>                Encoding: quoted-printable

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Developing for the web?  See http://jakarta.apache.org/velocity/