You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "LAU, Roger, GBM" <Ro...@rbs.com> on 2008/07/23 15:50:48 UTC
velocity.properties isn't being read
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>
</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.
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
______________________________________________________________________
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
yeah, what you are seeing is the WebappLoader being initialized by the
VelocityEngine that the VelocityViewServlet is using, and then the
Velocity singleton initializing it's default, the FileResourceLoader.
On Thu, Jul 24, 2008 at 9:02 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Hi Nathan, just had an idea what might be happening. From the log files it appears as though tomcat might be loading the Webapploader first, then the FileResourceLoader second. However, getTemplate() requests are being sent to the FileResourceLoader instead of the WebappLoader. Is this possible? How do I disable the FileResourceLoader if this is the case?
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 24 July 2008 16:16
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> Does the AutoMatchingServlet extend the VelocityViewServlet or
> VelocityLayoutServlet? If not, then it needs to do so (or else you
> have a more work cut out for you :). If it does extend one of those,
> then i'm very confused as to why this isn't working, and would next
> want to see what your logs say when you load the servlet.
>
> On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> OK, thanks for that. Here's my web.xml file.
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <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">
>>
>> <display-name>AutoMatching Tool</display-name>
>> <description>
>> AutoMatching Tool
>> </description>
>>
>> <servlet>
>> <servlet-name>automatchingServlet</servlet-name>
>>
>> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
>> <param-value>/WEB-INF/velocity.properties</param-value>
>> </init-param>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>automatchingServlet</servlet-name>
>> <url-pattern>*.vm</url-pattern>
>> </servlet-mapping>
>> </web-app>
>>
>>
>> -----Original Message-----
>> From: Nathan Bubna [mailto:nbubna@gmail.com]
>> Sent: 23 July 2008 17:47
>> To: Velocity Users List
>> Subject: Re: velocity.properties isn't being read
>>
>> your velocity.properties file looks fine, and if you are using
>> VelocityTools 1.4, then it should say in the logs if it managed to
>> load a custom velocity.properties. So, it looks like your web.xml
>> still needs some adjustment. Could you post that as it currently is?
>>
>> Finally, you only need to use one of the velocity-tools-*-1.4.jar
>> files. If you are using VelocityStruts, then use the
>> velocity-tools-1.4.jar. If you are just using
>> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
>> integration, then just use the velocity-tools-view-1.4.jar. It
>> includes all of the classes in the velocity-tools-generic-1.4.jar
>> already, so that is unnecessary.
>>
>> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>>> 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 <Ro...@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 <Ro...@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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
Hi Nathan, just had an idea what might be happening. From the log files it appears as though tomcat might be loading the Webapploader first, then the FileResourceLoader second. However, getTemplate() requests are being sent to the FileResourceLoader instead of the WebappLoader. Is this possible? How do I disable the FileResourceLoader if this is the case?
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 24 July 2008 16:16
To: Velocity Users List
Subject: Re: velocity.properties isn't being read
Does the AutoMatchingServlet extend the VelocityViewServlet or
VelocityLayoutServlet? If not, then it needs to do so (or else you
have a more work cut out for you :). If it does extend one of those,
then i'm very confused as to why this isn't working, and would next
want to see what your logs say when you load the servlet.
On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> OK, thanks for that. Here's my web.xml file.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <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">
>
> <display-name>AutoMatching Tool</display-name>
> <description>
> AutoMatching Tool
> </description>
>
> <servlet>
> <servlet-name>automatchingServlet</servlet-name>
>
> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>automatchingServlet</servlet-name>
> <url-pattern>*.vm</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 23 July 2008 17:47
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> your velocity.properties file looks fine, and if you are using
> VelocityTools 1.4, then it should say in the logs if it managed to
> load a custom velocity.properties. So, it looks like your web.xml
> still needs some adjustment. Could you post that as it currently is?
>
> Finally, you only need to use one of the velocity-tools-*-1.4.jar
> files. If you are using VelocityStruts, then use the
> velocity-tools-1.4.jar. If you are just using
> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
> integration, then just use the velocity-tools-view-1.4.jar. It
> includes all of the classes in the velocity-tools-generic-1.4.jar
> already, so that is unnecessary.
>
> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> 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 <Ro...@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 <Ro...@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
>>
>>
>
> ---------------------------------------------------------------------
> 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
Re: toolbox.xml problem
Posted by Nathan Bubna <nb...@gmail.com>.
On Mon, Jul 28, 2008 at 8:38 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Thanks Nathan, that worked. I was creating a new VelocityContext. btw, most of the examples in the Developer's Guide specify creating contexts in this way.
well, the Developer's Guide isn't really meant to have VelocityTools'
specific info. perhaps we can find another place for such examples...
> Cheers
> Roger
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 28 July 2008 16:26
> To: Velocity Users List
> Subject: Re: toolbox.xml problem
>
> *How* are you using the VelocityViewServlet? The tools are made
> available via the Context created by the createContext(...) method.
> If you do not use VVS.doRequest(req,res) to process requests, then you
> must call createContext(...) yourself and use that Context to merge
> with your templates.
>
> On Mon, Jul 28, 2008 at 3:33 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> Hi,
>>
>> my templates are not able to access the tools I have configured in my toolbox.xml file. I've tried both <data> and <tool> elements with no success. I am using the VelocityViewServlet. I've confirmed that the correct toolbox.xml file is being read through setting deliberately incorrect class names for the DateTool and seeing resulting errors in the Catalina.log file.
>>
>> Here is my toolbox.xml files. Can anyone shine any light this please.
>>
>> <?xml version="1.0"?>
>> <toolbox>
>> <data type="number">
>> <key>libor</key>
>> <value>5.5609</value>
>> </data>
>> <!-- logger object-->
>> <tool>
>> <key>logger</key>
>> <scope>application</scope>
>> <class>org.apache.velocity.tools.generic.log.LogSystemCommonsLog</class>
>> </tool>
>> <!-- format dates-->
>> <tool>
>> <key>date</key>
>> <scope>request</scope>
>> <class>org.apache.velocity.tools.generic.DateTool</class>
>> <parameter name="format" value="yyyy-M-d"/>
>> </tool>
>> <!-- format number-->
>> <tool>
>> <key>number</key>
>> <scope>application</scope>
>> <class>org.apache.velocity.tools.generic.NumberTool</class>
>> </tool>
>> </toolbox>
>>
>>
>>
>>
>>
>>
>>
>> ***********************************************************************************
>> 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
>> ***********************************************************************************
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
> ---------------------------------------------------------------------
> 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
RE: toolbox.xml problem
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
Thanks Nathan, that worked. I was creating a new VelocityContext. btw, most of the examples in the Developer's Guide specify creating contexts in this way.
Cheers
Roger
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 28 July 2008 16:26
To: Velocity Users List
Subject: Re: toolbox.xml problem
*How* are you using the VelocityViewServlet? The tools are made
available via the Context created by the createContext(...) method.
If you do not use VVS.doRequest(req,res) to process requests, then you
must call createContext(...) yourself and use that Context to merge
with your templates.
On Mon, Jul 28, 2008 at 3:33 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Hi,
>
> my templates are not able to access the tools I have configured in my toolbox.xml file. I've tried both <data> and <tool> elements with no success. I am using the VelocityViewServlet. I've confirmed that the correct toolbox.xml file is being read through setting deliberately incorrect class names for the DateTool and seeing resulting errors in the Catalina.log file.
>
> Here is my toolbox.xml files. Can anyone shine any light this please.
>
> <?xml version="1.0"?>
> <toolbox>
> <data type="number">
> <key>libor</key>
> <value>5.5609</value>
> </data>
> <!-- logger object-->
> <tool>
> <key>logger</key>
> <scope>application</scope>
> <class>org.apache.velocity.tools.generic.log.LogSystemCommonsLog</class>
> </tool>
> <!-- format dates-->
> <tool>
> <key>date</key>
> <scope>request</scope>
> <class>org.apache.velocity.tools.generic.DateTool</class>
> <parameter name="format" value="yyyy-M-d"/>
> </tool>
> <!-- format number-->
> <tool>
> <key>number</key>
> <scope>application</scope>
> <class>org.apache.velocity.tools.generic.NumberTool</class>
> </tool>
> </toolbox>
>
>
>
>
>
>
>
> ***********************************************************************************
> 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
> ***********************************************************************************
>
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: toolbox.xml problem
Posted by Nathan Bubna <nb...@gmail.com>.
*How* are you using the VelocityViewServlet? The tools are made
available via the Context created by the createContext(...) method.
If you do not use VVS.doRequest(req,res) to process requests, then you
must call createContext(...) yourself and use that Context to merge
with your templates.
On Mon, Jul 28, 2008 at 3:33 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Hi,
>
> my templates are not able to access the tools I have configured in my toolbox.xml file. I've tried both <data> and <tool> elements with no success. I am using the VelocityViewServlet. I've confirmed that the correct toolbox.xml file is being read through setting deliberately incorrect class names for the DateTool and seeing resulting errors in the Catalina.log file.
>
> Here is my toolbox.xml files. Can anyone shine any light this please.
>
> <?xml version="1.0"?>
> <toolbox>
> <data type="number">
> <key>libor</key>
> <value>5.5609</value>
> </data>
> <!-- logger object-->
> <tool>
> <key>logger</key>
> <scope>application</scope>
> <class>org.apache.velocity.tools.generic.log.LogSystemCommonsLog</class>
> </tool>
> <!-- format dates-->
> <tool>
> <key>date</key>
> <scope>request</scope>
> <class>org.apache.velocity.tools.generic.DateTool</class>
> <parameter name="format" value="yyyy-M-d"/>
> </tool>
> <!-- format number-->
> <tool>
> <key>number</key>
> <scope>application</scope>
> <class>org.apache.velocity.tools.generic.NumberTool</class>
> </tool>
> </toolbox>
>
>
>
>
>
>
>
> ***********************************************************************************
> 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
> ***********************************************************************************
>
>
> ---------------------------------------------------------------------
> 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
toolbox.xml problem
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
Hi,
my templates are not able to access the tools I have configured in my toolbox.xml file. I've tried both <data> and <tool> elements with no success. I am using the VelocityViewServlet. I've confirmed that the correct toolbox.xml file is being read through setting deliberately incorrect class names for the DateTool and seeing resulting errors in the Catalina.log file.
Here is my toolbox.xml files. Can anyone shine any light this please.
<?xml version="1.0"?>
<toolbox>
<data type="number">
<key>libor</key>
<value>5.5609</value>
</data>
<!-- logger object-->
<tool>
<key>logger</key>
<scope>application</scope>
<class>org.apache.velocity.tools.generic.log.LogSystemCommonsLog</class>
</tool>
<!-- format dates-->
<tool>
<key>date</key>
<scope>request</scope>
<class>org.apache.velocity.tools.generic.DateTool</class>
<parameter name="format" value="yyyy-M-d"/>
</tool>
<!-- format number-->
<tool>
<key>number</key>
<scope>application</scope>
<class>org.apache.velocity.tools.generic.NumberTool</class>
</tool>
</toolbox>
***********************************************************************************
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
***********************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
On Thu, Jul 24, 2008 at 9:53 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Nice one Nathan. That worked. calling VelocityViewServlet.getVelocityEngine() did the trick.
>
> Now one last question. If I create another servlet that extends VelocityViewServlet, will it use the same WebappLoader configuration as the AutoMatchingServlet? I'm assuming it will.
if you give it the same init-params, yes. if not, then no. :) it
would be a separate instance**, so it would have to use the same
toolbox.xml and velocity.properties to have the same configuration.
**Note that this is not true of the upcoming VelocityTools 2, in which
they would share the same underlying VelocityView (as initialized by
the first servlet loaded) by default.
> Many thanks for your help, mate.
> Roger
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 24 July 2008 17:30
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> response below...
>
> On Thu, Jul 24, 2008 at 8:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> Cheers for you help so far Nathan.
>>
>> The AutoMatchingServlet extends VelocityViewServlet.
>
> good.
>
>> I've checked the logs and yes, the WebappLoader is being used and the webapp.resource.loader.path is being set to /templates/
>>
>> So not sure why it doesn't pick up the template.
>
> depends on what "it" is (see further down)
>
>> the directory structure for my automatch webapp is
>>
>> $CATALINA_HOME/webapps/automatch/
>> WEB-INF/
>> web.xml
>> velocity.properties
>> templates/
>> trade_profile.vm
>>
>>
>>
>> the call to getTemplate is simply...
>>
>> Template template = Velocity.getTemplate("trade_profile.vm");
>
> there's the problem! VelocityViewServlet doesn't configure the
> singleton. it configures it's own VelocityEngine.
>
> your VelocityViewServlet subclass can get the configured
> VelocityEngine by calling getVelocityEngine() after the servlet has
> been initialized. If you really want to use the singleton, then
> you'll have to configure it yourself. if you want to use the same
> velocity.properties file, then you'll need to add these (which the
> VelocityViewServlet adds automatically to the engine it configures):
>
> runtime.log.logsystem.class =
> org.apache.velocity.tools.view.servlet.ServletLogger
> resource.loader = webapp
> webapp.resource.loader.class =
> org.apache.velocity.tools.view.servlet.WebappLoader
>
>>
>> Here are the relevant sections from the localhost and catalina log files...
>>
>> localhost.log file:
>>
>> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
>> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
>> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: contextInitialized()
>> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: contextInitialized()
>> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: contextInitialized()
>> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: contextInitialized()
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [info] VelocityViewServlet: Using custom properties at '/WEB-INF/velocity.properties'
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : *******************************************************************
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : RuntimeInstance initializing.
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Trying to use logger class org.apache.velocity.tools.view.servlet.ServletLogger
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [info] LogSystem has been deprecated. Please use a LogChute implementation.
>> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] ResourceLoader instantiated: org.apache.velocity.tools.view.servlet.WebappLoader
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] WebappLoader : initialization starting.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [info] WebappLoader : added template path - '/templates/'
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] WebappLoader : initialization complete.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : Default ResourceManager initialization complete.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Created '20' parsers.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : Velocimacro : initialization starting.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : Default library not found.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : Velocimacro : Velocimacro : initialization complete.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity : RuntimeInstance successfully initialized.
>> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Velocity [info] VelocityViewServlet: Default content-type is: text/html
>>
>> --- --- --- ------ ------ ------ ------ ------ ------ ---
>>
>> Catalina.log file
>>
>> 24-Jul-2008 16:47:59 org.apache.coyote.http11.Http11BaseProtocol init
>> INFO: Initializing Coyote HTTP/1.1 on http-8080
>> 24-Jul-2008 16:48:00 org.apache.catalina.startup.Catalina load
>> INFO: Initialization processed in 719 ms
>> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardService start
>> INFO: Starting service Catalina
>> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardEngine start
>> INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
>> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardHost start
>> INFO: XML validation disabled
>> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig authenticatorConfig
>> SEVERE: Cannot configure an authenticator for method CUSTFORM5
>> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig start
>> SEVERE: Marking this application unavailable due to previous error(s)
>> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
>> SEVERE: Error getConfigured
>> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
>> SEVERE: Context [/slice] startup failed due to previous errors
>> 24-Jul-2008 16:48:02 org.apache.coyote.http11.Http11BaseProtocol start
>> INFO: Starting Coyote HTTP/1.1 on http-8080
>> 24-Jul-2008 16:48:03 org.apache.jk.common.ChannelSocket init
>> INFO: JK: ajp13 listening on /0.0.0.0:8009
>> 24-Jul-2008 16:48:03 org.apache.jk.server.JkMain start
>> INFO: Jk running ID=0 time=0/47 config=null
>> 24-Jul-2008 16:48:03 org.apache.catalina.startup.Catalina start
>> INFO: Server startup in 3141 ms
>> 24-Jul-2008 16:48:31 org.apache.velocity.tools.view.servlet.ServletToolboxManager getInstance
>> INFO: Using config file '/WEB-INF/toolbox.xml'
>> 24-Jul-2008 16:48:31 org.apache.velocity.runtime.log.JdkLogChute log
>> INFO: FileResourceLoader : adding path '.'
>> 24-Jul-2008 16:48:32 org.apache.velocity.runtime.log.JdkLogChute log
>> SEVERE: ResourceManager : unable to find resource 'trade_profile.vm' in any resource loader.
>>
>>
>>
>>
>> -----Original Message-----
>> From: Nathan Bubna [mailto:nbubna@gmail.com]
>> Sent: 24 July 2008 16:16
>> To: Velocity Users List
>> Subject: Re: velocity.properties isn't being read
>>
>> Does the AutoMatchingServlet extend the VelocityViewServlet or
>> VelocityLayoutServlet? If not, then it needs to do so (or else you
>> have a more work cut out for you :). If it does extend one of those,
>> then i'm very confused as to why this isn't working, and would next
>> want to see what your logs say when you load the servlet.
>>
>> On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>>> OK, thanks for that. Here's my web.xml file.
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <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">
>>>
>>> <display-name>AutoMatching Tool</display-name>
>>> <description>
>>> AutoMatching Tool
>>> </description>
>>>
>>> <servlet>
>>> <servlet-name>automatchingServlet</servlet-name>
>>>
>>> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
>>> <param-value>/WEB-INF/velocity.properties</param-value>
>>> </init-param>
>>> </servlet>
>>>
>>> <servlet-mapping>
>>> <servlet-name>automatchingServlet</servlet-name>
>>> <url-pattern>*.vm</url-pattern>
>>> </servlet-mapping>
>>> </web-app>
>>>
>>>
>>> -----Original Message-----
>>> From: Nathan Bubna [mailto:nbubna@gmail.com]
>>> Sent: 23 July 2008 17:47
>>> To: Velocity Users List
>>> Subject: Re: velocity.properties isn't being read
>>>
>>> your velocity.properties file looks fine, and if you are using
>>> VelocityTools 1.4, then it should say in the logs if it managed to
>>> load a custom velocity.properties. So, it looks like your web.xml
>>> still needs some adjustment. Could you post that as it currently is?
>>>
>>> Finally, you only need to use one of the velocity-tools-*-1.4.jar
>>> files. If you are using VelocityStruts, then use the
>>> velocity-tools-1.4.jar. If you are just using
>>> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
>>> integration, then just use the velocity-tools-view-1.4.jar. It
>>> includes all of the classes in the velocity-tools-generic-1.4.jar
>>> already, so that is unnecessary.
>>>
>>> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>>>> 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 <Ro...@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 <Ro...@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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
Nice one Nathan. That worked. calling VelocityViewServlet.getVelocityEngine() did the trick.
Now one last question. If I create another servlet that extends VelocityViewServlet, will it use the same WebappLoader configuration as the AutoMatchingServlet? I'm assuming it will.
Many thanks for your help, mate.
Roger
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 24 July 2008 17:30
To: Velocity Users List
Subject: Re: velocity.properties isn't being read
response below...
On Thu, Jul 24, 2008 at 8:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Cheers for you help so far Nathan.
>
> The AutoMatchingServlet extends VelocityViewServlet.
good.
> I've checked the logs and yes, the WebappLoader is being used and the webapp.resource.loader.path is being set to /templates/
>
> So not sure why it doesn't pick up the template.
depends on what "it" is (see further down)
> the directory structure for my automatch webapp is
>
> $CATALINA_HOME/webapps/automatch/
> WEB-INF/
> web.xml
> velocity.properties
> templates/
> trade_profile.vm
>
>
>
> the call to getTemplate is simply...
>
> Template template = Velocity.getTemplate("trade_profile.vm");
there's the problem! VelocityViewServlet doesn't configure the
singleton. it configures it's own VelocityEngine.
your VelocityViewServlet subclass can get the configured
VelocityEngine by calling getVelocityEngine() after the servlet has
been initialized. If you really want to use the singleton, then
you'll have to configure it yourself. if you want to use the same
velocity.properties file, then you'll need to add these (which the
VelocityViewServlet adds automatically to the engine it configures):
runtime.log.logsystem.class =
org.apache.velocity.tools.view.servlet.ServletLogger
resource.loader = webapp
webapp.resource.loader.class =
org.apache.velocity.tools.view.servlet.WebappLoader
>
> Here are the relevant sections from the localhost and catalina log files...
>
> localhost.log file:
>
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] VelocityViewServlet: Using custom properties at '/WEB-INF/velocity.properties'
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : *******************************************************************
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : RuntimeInstance initializing.
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Trying to use logger class org.apache.velocity.tools.view.servlet.ServletLogger
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] LogSystem has been deprecated. Please use a LogChute implementation.
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] ResourceLoader instantiated: org.apache.velocity.tools.view.servlet.WebappLoader
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] WebappLoader : initialization starting.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] WebappLoader : added template path - '/templates/'
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] WebappLoader : initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Default ResourceManager initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Created '20' parsers.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Velocimacro : initialization starting.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : Default library not found.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Velocimacro : Velocimacro : initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : RuntimeInstance successfully initialized.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] VelocityViewServlet: Default content-type is: text/html
>
> --- --- --- ------ ------ ------ ------ ------ ------ ---
>
> Catalina.log file
>
> 24-Jul-2008 16:47:59 org.apache.coyote.http11.Http11BaseProtocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> 24-Jul-2008 16:48:00 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 719 ms
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig authenticatorConfig
> SEVERE: Cannot configure an authenticator for method CUSTFORM5
> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig start
> SEVERE: Marking this application unavailable due to previous error(s)
> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
> SEVERE: Error getConfigured
> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
> SEVERE: Context [/slice] startup failed due to previous errors
> 24-Jul-2008 16:48:02 org.apache.coyote.http11.Http11BaseProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> 24-Jul-2008 16:48:03 org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 24-Jul-2008 16:48:03 org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/47 config=null
> 24-Jul-2008 16:48:03 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 3141 ms
> 24-Jul-2008 16:48:31 org.apache.velocity.tools.view.servlet.ServletToolboxManager getInstance
> INFO: Using config file '/WEB-INF/toolbox.xml'
> 24-Jul-2008 16:48:31 org.apache.velocity.runtime.log.JdkLogChute log
> INFO: FileResourceLoader : adding path '.'
> 24-Jul-2008 16:48:32 org.apache.velocity.runtime.log.JdkLogChute log
> SEVERE: ResourceManager : unable to find resource 'trade_profile.vm' in any resource loader.
>
>
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 24 July 2008 16:16
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> Does the AutoMatchingServlet extend the VelocityViewServlet or
> VelocityLayoutServlet? If not, then it needs to do so (or else you
> have a more work cut out for you :). If it does extend one of those,
> then i'm very confused as to why this isn't working, and would next
> want to see what your logs say when you load the servlet.
>
> On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> OK, thanks for that. Here's my web.xml file.
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <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">
>>
>> <display-name>AutoMatching Tool</display-name>
>> <description>
>> AutoMatching Tool
>> </description>
>>
>> <servlet>
>> <servlet-name>automatchingServlet</servlet-name>
>>
>> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
>> <param-value>/WEB-INF/velocity.properties</param-value>
>> </init-param>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>automatchingServlet</servlet-name>
>> <url-pattern>*.vm</url-pattern>
>> </servlet-mapping>
>> </web-app>
>>
>>
>> -----Original Message-----
>> From: Nathan Bubna [mailto:nbubna@gmail.com]
>> Sent: 23 July 2008 17:47
>> To: Velocity Users List
>> Subject: Re: velocity.properties isn't being read
>>
>> your velocity.properties file looks fine, and if you are using
>> VelocityTools 1.4, then it should say in the logs if it managed to
>> load a custom velocity.properties. So, it looks like your web.xml
>> still needs some adjustment. Could you post that as it currently is?
>>
>> Finally, you only need to use one of the velocity-tools-*-1.4.jar
>> files. If you are using VelocityStruts, then use the
>> velocity-tools-1.4.jar. If you are just using
>> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
>> integration, then just use the velocity-tools-view-1.4.jar. It
>> includes all of the classes in the velocity-tools-generic-1.4.jar
>> already, so that is unnecessary.
>>
>> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>>> 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 <Ro...@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 <Ro...@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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
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
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
response below...
On Thu, Jul 24, 2008 at 8:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> Cheers for you help so far Nathan.
>
> The AutoMatchingServlet extends VelocityViewServlet.
good.
> I've checked the logs and yes, the WebappLoader is being used and the webapp.resource.loader.path is being set to /templates/
>
> So not sure why it doesn't pick up the template.
depends on what "it" is (see further down)
> the directory structure for my automatch webapp is
>
> $CATALINA_HOME/webapps/automatch/
> WEB-INF/
> web.xml
> velocity.properties
> templates/
> trade_profile.vm
>
>
>
> the call to getTemplate is simply...
>
> Template template = Velocity.getTemplate("trade_profile.vm");
there's the problem! VelocityViewServlet doesn't configure the
singleton. it configures it's own VelocityEngine.
your VelocityViewServlet subclass can get the configured
VelocityEngine by calling getVelocityEngine() after the servlet has
been initialized. If you really want to use the singleton, then
you'll have to configure it yourself. if you want to use the same
velocity.properties file, then you'll need to add these (which the
VelocityViewServlet adds automatically to the engine it configures):
runtime.log.logsystem.class =
org.apache.velocity.tools.view.servlet.ServletLogger
resource.loader = webapp
webapp.resource.loader.class =
org.apache.velocity.tools.view.servlet.WebappLoader
>
> Here are the relevant sections from the localhost and catalina log files...
>
> localhost.log file:
>
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] VelocityViewServlet: Using custom properties at '/WEB-INF/velocity.properties'
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : *******************************************************************
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : RuntimeInstance initializing.
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Trying to use logger class org.apache.velocity.tools.view.servlet.ServletLogger
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] LogSystem has been deprecated. Please use a LogChute implementation.
> 24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] ResourceLoader instantiated: org.apache.velocity.tools.view.servlet.WebappLoader
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] WebappLoader : initialization starting.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] WebappLoader : added template path - '/templates/'
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] WebappLoader : initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Default ResourceManager initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Created '20' parsers.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Velocimacro : initialization starting.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : Default library not found.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : Velocimacro : Velocimacro : initialization complete.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity : RuntimeInstance successfully initialized.
> 24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [info] VelocityViewServlet: Default content-type is: text/html
>
> --- --- --- ------ ------ ------ ------ ------ ------ ---
>
> Catalina.log file
>
> 24-Jul-2008 16:47:59 org.apache.coyote.http11.Http11BaseProtocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> 24-Jul-2008 16:48:00 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 719 ms
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
> 24-Jul-2008 16:48:00 org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig authenticatorConfig
> SEVERE: Cannot configure an authenticator for method CUSTFORM5
> 24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig start
> SEVERE: Marking this application unavailable due to previous error(s)
> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
> SEVERE: Error getConfigured
> 24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
> SEVERE: Context [/slice] startup failed due to previous errors
> 24-Jul-2008 16:48:02 org.apache.coyote.http11.Http11BaseProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> 24-Jul-2008 16:48:03 org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 24-Jul-2008 16:48:03 org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/47 config=null
> 24-Jul-2008 16:48:03 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 3141 ms
> 24-Jul-2008 16:48:31 org.apache.velocity.tools.view.servlet.ServletToolboxManager getInstance
> INFO: Using config file '/WEB-INF/toolbox.xml'
> 24-Jul-2008 16:48:31 org.apache.velocity.runtime.log.JdkLogChute log
> INFO: FileResourceLoader : adding path '.'
> 24-Jul-2008 16:48:32 org.apache.velocity.runtime.log.JdkLogChute log
> SEVERE: ResourceManager : unable to find resource 'trade_profile.vm' in any resource loader.
>
>
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 24 July 2008 16:16
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> Does the AutoMatchingServlet extend the VelocityViewServlet or
> VelocityLayoutServlet? If not, then it needs to do so (or else you
> have a more work cut out for you :). If it does extend one of those,
> then i'm very confused as to why this isn't working, and would next
> want to see what your logs say when you load the servlet.
>
> On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> OK, thanks for that. Here's my web.xml file.
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <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">
>>
>> <display-name>AutoMatching Tool</display-name>
>> <description>
>> AutoMatching Tool
>> </description>
>>
>> <servlet>
>> <servlet-name>automatchingServlet</servlet-name>
>>
>> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
>> <param-value>/WEB-INF/velocity.properties</param-value>
>> </init-param>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>automatchingServlet</servlet-name>
>> <url-pattern>*.vm</url-pattern>
>> </servlet-mapping>
>> </web-app>
>>
>>
>> -----Original Message-----
>> From: Nathan Bubna [mailto:nbubna@gmail.com]
>> Sent: 23 July 2008 17:47
>> To: Velocity Users List
>> Subject: Re: velocity.properties isn't being read
>>
>> your velocity.properties file looks fine, and if you are using
>> VelocityTools 1.4, then it should say in the logs if it managed to
>> load a custom velocity.properties. So, it looks like your web.xml
>> still needs some adjustment. Could you post that as it currently is?
>>
>> Finally, you only need to use one of the velocity-tools-*-1.4.jar
>> files. If you are using VelocityStruts, then use the
>> velocity-tools-1.4.jar. If you are just using
>> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
>> integration, then just use the velocity-tools-view-1.4.jar. It
>> includes all of the classes in the velocity-tools-generic-1.4.jar
>> already, so that is unnecessary.
>>
>> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>>> 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 <Ro...@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 <Ro...@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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
Cheers for you help so far Nathan.
The AutoMatchingServlet extends VelocityViewServlet.
I've checked the logs and yes, the WebappLoader is being used and the webapp.resource.loader.path is being set to /templates/
So not sure why it doesn't pick up the template.
the directory structure for my automatch webapp is
$CATALINA_HOME/webapps/automatch/
WEB-INF/
web.xml
velocity.properties
templates/
trade_profile.vm
the call to getTemplate is simply...
Template template = Velocity.getTemplate("trade_profile.vm");
Here are the relevant sections from the localhost and catalina log files...
localhost.log file:
24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
24-Jul-2008 16:48:01 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
24-Jul-2008 16:48:02 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [info] VelocityViewServlet: Using custom properties at '/WEB-INF/velocity.properties'
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : *******************************************************************
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : RuntimeInstance initializing.
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Trying to use logger class org.apache.velocity.tools.view.servlet.ServletLogger
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [info] LogSystem has been deprecated. Please use a LogChute implementation.
24-Jul-2008 16:48:30 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] ResourceLoader instantiated: org.apache.velocity.tools.view.servlet.WebappLoader
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] WebappLoader : initialization starting.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [info] WebappLoader : added template path - '/templates/'
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] WebappLoader : initialization complete.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : Default ResourceManager initialization complete.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Created '20' parsers.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : Velocimacro : initialization starting.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : Default library not found.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : Velocimacro : Velocimacro : initialization complete.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity : RuntimeInstance successfully initialized.
24-Jul-2008 16:48:31 org.apache.catalina.core.ApplicationContext log
INFO: Velocity [info] VelocityViewServlet: Default content-type is: text/html
--- --- --- ------ ------ ------ ------ ------ ------ ---
Catalina.log file
24-Jul-2008 16:47:59 org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
24-Jul-2008 16:48:00 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 719 ms
24-Jul-2008 16:48:00 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
24-Jul-2008 16:48:00 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
24-Jul-2008 16:48:00 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig authenticatorConfig
SEVERE: Cannot configure an authenticator for method CUSTFORM5
24-Jul-2008 16:48:02 org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
24-Jul-2008 16:48:02 org.apache.catalina.core.StandardContext start
SEVERE: Context [/slice] startup failed due to previous errors
24-Jul-2008 16:48:02 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
24-Jul-2008 16:48:03 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
24-Jul-2008 16:48:03 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/47 config=null
24-Jul-2008 16:48:03 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3141 ms
24-Jul-2008 16:48:31 org.apache.velocity.tools.view.servlet.ServletToolboxManager getInstance
INFO: Using config file '/WEB-INF/toolbox.xml'
24-Jul-2008 16:48:31 org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
24-Jul-2008 16:48:32 org.apache.velocity.runtime.log.JdkLogChute log
SEVERE: ResourceManager : unable to find resource 'trade_profile.vm' in any resource loader.
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 24 July 2008 16:16
To: Velocity Users List
Subject: Re: velocity.properties isn't being read
Does the AutoMatchingServlet extend the VelocityViewServlet or
VelocityLayoutServlet? If not, then it needs to do so (or else you
have a more work cut out for you :). If it does extend one of those,
then i'm very confused as to why this isn't working, and would next
want to see what your logs say when you load the servlet.
On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> OK, thanks for that. Here's my web.xml file.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <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">
>
> <display-name>AutoMatching Tool</display-name>
> <description>
> AutoMatching Tool
> </description>
>
> <servlet>
> <servlet-name>automatchingServlet</servlet-name>
>
> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>automatchingServlet</servlet-name>
> <url-pattern>*.vm</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 23 July 2008 17:47
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> your velocity.properties file looks fine, and if you are using
> VelocityTools 1.4, then it should say in the logs if it managed to
> load a custom velocity.properties. So, it looks like your web.xml
> still needs some adjustment. Could you post that as it currently is?
>
> Finally, you only need to use one of the velocity-tools-*-1.4.jar
> files. If you are using VelocityStruts, then use the
> velocity-tools-1.4.jar. If you are just using
> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
> integration, then just use the velocity-tools-view-1.4.jar. It
> includes all of the classes in the velocity-tools-generic-1.4.jar
> already, so that is unnecessary.
>
> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> 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 <Ro...@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 <Ro...@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
>>
>>
>
> ---------------------------------------------------------------------
> 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
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
Does the AutoMatchingServlet extend the VelocityViewServlet or
VelocityLayoutServlet? If not, then it needs to do so (or else you
have a more work cut out for you :). If it does extend one of those,
then i'm very confused as to why this isn't working, and would next
want to see what your logs say when you load the servlet.
On Thu, Jul 24, 2008 at 1:55 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> OK, thanks for that. Here's my web.xml file.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <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">
>
> <display-name>AutoMatching Tool</display-name>
> <description>
> AutoMatching Tool
> </description>
>
> <servlet>
> <servlet-name>automatchingServlet</servlet-name>
>
> <servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>automatchingServlet</servlet-name>
> <url-pattern>*.vm</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: 23 July 2008 17:47
> To: Velocity Users List
> Subject: Re: velocity.properties isn't being read
>
> your velocity.properties file looks fine, and if you are using
> VelocityTools 1.4, then it should say in the logs if it managed to
> load a custom velocity.properties. So, it looks like your web.xml
> still needs some adjustment. Could you post that as it currently is?
>
> Finally, you only need to use one of the velocity-tools-*-1.4.jar
> files. If you are using VelocityStruts, then use the
> velocity-tools-1.4.jar. If you are just using
> VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
> integration, then just use the velocity-tools-view-1.4.jar. It
> includes all of the classes in the velocity-tools-generic-1.4.jar
> already, so that is unnecessary.
>
> On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
>> 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 <Ro...@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 <Ro...@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
>>
>>
>
> ---------------------------------------------------------------------
> 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
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
OK, thanks for that. Here's my web.xml file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<display-name>AutoMatching Tool</display-name>
<description>
AutoMatching Tool
</description>
<servlet>
<servlet-name>automatchingServlet</servlet-name>
<servlet-class>gbmft.automatch.AutoMatchingServlet</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>org.apache.velocity.properties</param-name>
<param-value>/WEB-INF/velocity.properties</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>automatchingServlet</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
</web-app>
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: 23 July 2008 17:47
To: Velocity Users List
Subject: Re: velocity.properties isn't being read
your velocity.properties file looks fine, and if you are using
VelocityTools 1.4, then it should say in the logs if it managed to
load a custom velocity.properties. So, it looks like your web.xml
still needs some adjustment. Could you post that as it currently is?
Finally, you only need to use one of the velocity-tools-*-1.4.jar
files. If you are using VelocityStruts, then use the
velocity-tools-1.4.jar. If you are just using
VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
integration, then just use the velocity-tools-view-1.4.jar. It
includes all of the classes in the velocity-tools-generic-1.4.jar
already, so that is unnecessary.
On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> 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 <Ro...@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 <Ro...@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
>
>
---------------------------------------------------------------------
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
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
your velocity.properties file looks fine, and if you are using
VelocityTools 1.4, then it should say in the logs if it managed to
load a custom velocity.properties. So, it looks like your web.xml
still needs some adjustment. Could you post that as it currently is?
Finally, you only need to use one of the velocity-tools-*-1.4.jar
files. If you are using VelocityStruts, then use the
velocity-tools-1.4.jar. If you are just using
VelocityViewServlet/VelocityLayoutServet and don't need Struts 1.x
integration, then just use the velocity-tools-view-1.4.jar. It
includes all of the classes in the velocity-tools-generic-1.4.jar
already, so that is unnecessary.
On Wed, Jul 23, 2008 at 9:32 AM, LAU, Roger, GBM <Ro...@rbs.com> wrote:
> 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 <Ro...@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 <Ro...@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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
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 <Ro...@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 <Ro...@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
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
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 <Ro...@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 <Ro...@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
RE: velocity.properties isn't being read
Posted by "LAU, Roger, GBM" <Ro...@rbs.com>.
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 <Ro...@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
Re: velocity.properties isn't being read
Posted by Nathan Bubna <nb...@gmail.com>.
answers below...
On Wed, Jul 23, 2008 at 6:50 AM, LAU, Roger, GBM <Ro...@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