velocity-user mailing list archives

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


Mime
View raw message