velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LAU, Roger, GBM" <Roger....@rbs.com>
Subject RE: velocity.properties isn't being read
Date Wed, 23 Jul 2008 16:32:17 GMT
I'm using

velocity-tools-1.4.jar
velocity-tools-generic-1.4.jar
velocity-tools-view-1.4.jar

velocity.properties file....

# config file
#
webapp.resource.loader.path = /templates/
velocimacro.library = macro_library.vm

# Filepath for error template, relative to web application root directory
#
tools.view.servlet.error.template = error.vm

# Directory for layout templates, relative to web application root directory
#
tools.view.servlet.layout.directory = layout/

# Filepath of the default layout template relative to the layout directory
# NOT relative to the root directory of the webapp!
#
tools.view.servlet.layout.default.template =  default.vm


Thanks
Roger

-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 23 July 2008 17:26
To: Velocity Users List
Subject: Re: velocity.properties isn't being read

ok, just to keep things straight.  what version of VelocityTools are
you using?  and can i see your whole velocity.properties file?

On Wed, Jul 23, 2008 at 9:03 AM, LAU, Roger, GBM <Roger.LAU@rbs.com> wrote:
> thanks for the fast reply Nathan.
>
> OK, I've added the following to velocity.properties
>
> webapp.resource.loader.path = /templates/
>
> I've updated my web.xml as you suggested. Now when I'm getting this output on stdout...
>
> INFO: Server startup in 1844 ms
> 23-Jul-2008 16:54:51 org.apache.velocity.tools.view.servlet.ServletToolboxManager getInstance
> INFO: Using config file '/WEB-INF/toolbox.xml'
> 23-Jul-2008 16:54:52 org.apache.velocity.runtime.log.JdkLogChute log
> INFO: FileResourceLoader : adding path '.'
> 23-Jul-2008 16:54:52 org.apache.velocity.runtime.log.JdkLogChute log
> SEVERE: ResourceManager : unable to find resource 'trade_profile.vm' in any resource
loader.
>
>
> It looks like it's still using the FileResourceLoader.
> I also tried adding the following to velocity.properties
>
> resource.loader = webapp
>
> and got the same result as above. I then tried the following entry
>
> resource.loader =
>
> with the same results. Any ideas?
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 23 July 2008 16:44
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> answers below...
>
> On Wed, Jul 23, 2008 at 6:50 AM, LAU, Roger, GBM <Roger.LAU@rbs.com> wrote:
>> Hi,
>>
>> I'm trying to get a webapp to read template files from a template directory located
under the web application root /template/
>>
>> I tried to use the Velocity Singleton with the FileResourceLoader, specifying different
paths in velocity.properties such as
>>
>> file.resource.loader.path = ../webapps/app_name/template/
>>
>> But no matter what I set the path to, velocity still seems to use the default FileResourceLoader
path of '.'
>>
>> I've confirmed this by placing a template in $CATALINA_HOME/bin
>> where velocity is able to find the template correctly. It seems as though the velocity.properties
file isn't being read.
>>
>> Here is my web.xml file. You can see I've got the <init-param>
>>
>> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>>          version="2.4">
>>
>>          <servlet>
>>                   <servlet-name>automatchingServlet</servlet-name>
>>
>>                   <servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
>>
>>                   <init-param>
>>                             <param-name>org.apache.velocity.toolbox</param-name>
>>                             <param-value>/WEB-INF/toolbox.xml</param-value>
>>                   </init-param>
>>
>>                   <init-param>
>>                             <param-name>properties</param-name>
>>                             <param-value>/WEB-INF/velocity.properties</param-value>
>>                   </init-param>
>
> this should be <param-name>org.apache.velocity.properties</param-name>
>
>>          </servlet>
>>
>>          <servlet-mapping>
>>                   <servlet-name>automatchingServlet</servlet-name>
>>                   <url-pattern>*.vm</url-pattern>
>>          </servlet-mapping>
>> </web-app>
>>
>> How do I configure the FileResourceLoader to find my template files? I've read several
posts and although the WebappResourceLoader would be a good solution, but I'm not able to
use a beta version of velocity tools.
>
> so don't use the beta version. :)  in VelocityTools 1.1 thru 1.4, the
> default resource loader is the WebappLoader.   It works just as well
> as the WebappResourceLoader in VelocityTools 2.x, because it is the
> same class, just renamed to properly fit the conventions for resource
> loader naming.  really, there is no need for the FileResourceLoader.
> just change the param-name above and add this to your
> velocity.properties:
>
> webapp.resource.loader.path = /template/
>
> that should do the trick.
>
>> Thanks
>> Roger
>>
>>
>>
>>
>>
>>
>> ***********************************************************************************
>> The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office:
36 St Andrew Square, Edinburgh EH2 2YB.
>> Authorised and regulated by the Financial Services Authority
>>
>> This e-mail message is confidential and for use by the
>> addressee only. If the message is received by anyone other
>> than the addressee, please return the message to the sender
>> by replying to it and then delete the message from your
>> computer. Internet e-mails are not necessarily secure. The
>> Royal Bank of Scotland plc does not accept responsibility for
>> changes made to this message after it was sent.
>>
>> Whilst all reasonable care has been taken to avoid the
>> transmission of viruses, it is the responsibility of the recipient to
>> ensure that the onward transmission, opening or use of this
>> message and any attachments will not adversely affect its
>> systems or data. No responsibility is accepted by The
>> Royal Bank of Scotland plc in this regard and the recipient should carry
>> out such virus and other checks as it considers appropriate.
>> Visit our websites at:
>> www.rbs.com
>> www.rbs.com/gbm
>> www.rbsgc.com
>> ***********************************************************************************
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> ______________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message