velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Mason <and...@assertis.co.uk>
Subject Re: macro / parse problem on first run
Date Wed, 10 Aug 2005 13:47:01 GMT
Yep,
that worked. 
Thank you.
On Wed August 10 2005 2:40 pm, Jean Francois Chamard wrote:
> Hi,
> we see, in the log file, that it never load "menu.vm".
>
> Try to rename menu.vm to VM_global_library.vm and reload the context to
> see if it finds it (in your log)
> Jeff
>
> Andrew Mason wrote:
> >The following is the velocity.log.
> >It does have an error regarding the macros' but not regarding my menu.vm
> > that i can see.
> >
> >thanks in advance.
> >
> >am@nibbler:/var/www/obb$ tail -f -n 200 velocity.log
> >Wed Aug 10 14:07:22 BST 2005  [debug] AvalonLogSystem initialized using
> >logfile '/var/www/obb/velocity.log'
> >Wed Aug 10 14:07:22 BST 2005   [info]
> >**************************************************************
> >Wed Aug 10 14:07:22 BST 2005   [info] Starting Jakarta Velocity v1.4
> >Wed Aug 10 14:07:22 BST 2005   [info] RuntimeInstance initializing.
> >Wed Aug 10 14:07:22 BST 2005   [info] Default Properties File:
> >org/apache/velocity/runtime/defaults/velocity.properties
> >Wed Aug 10 14:07:22 BST 2005   [info] Trying to use logger class
> >org.apache.velocity.runtime.log.AvalonLogSystem
> >Wed Aug 10 14:07:22 BST 2005   [info] Using logger class
> >org.apache.velocity.runtime.log.AvalonLogSystem
> >Wed Aug 10 14:07:22 BST 2005   [info] Default ResourceManager
> > initializing. (class
> > org.apache.velocity.runtime.resource.ResourceManagerImpl)
> >Wed Aug 10 14:07:22 BST 2005   [info] Resource Loader Instantiated:
> >org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >Wed Aug 10 14:07:22 BST 2005   [info] FileResourceLoader : initialization
> >starting.
> >Wed Aug 10 14:07:22 BST 2005   [info] FileResourceLoader : adding path
> >'/var/www/obb/'
> >Wed Aug 10 14:07:22 BST 2005   [info] FileResourceLoader : initialization
> >complete.
> >Wed Aug 10 14:07:22 BST 2005   [info] ResourceCache : initialized. (class
> >org.apache.velocity.runtime.resource.ResourceCacheImpl)
> >Wed Aug 10 14:07:22 BST 2005   [info] Default ResourceManager
> > initialization complete.
> >Wed Aug 10 14:07:22 BST 2005   [info] Loaded System Directive:
> >org.apache.velocity.runtime.directive.Literal
> >Wed Aug 10 14:07:22 BST 2005   [info] Loaded System Directive:
> >org.apache.velocity.runtime.directive.Macro
> >Wed Aug 10 14:07:22 BST 2005   [info] Loaded System Directive:
> >org.apache.velocity.runtime.directive.Parse
> >Wed Aug 10 14:07:22 BST 2005   [info] Loaded System Directive:
> >org.apache.velocity.runtime.directive.Include
> >Wed Aug 10 14:07:22 BST 2005   [info] Loaded System Directive:
> >org.apache.velocity.runtime.directive.Foreach
> >Wed Aug 10 14:07:22 BST 2005   [info] Created: 20 parsers.
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : initialization
> > starting. Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : adding VMs
> > from VM library template : VM_global_library.vm
> >Wed Aug 10 14:07:22 BST 2005  [error] ResourceManager : unable to find
> >resource 'VM_global_library.vm' in any resource loader.
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : error using  VM
> > library template VM_global_library.vm :
> >org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> >resource 'VM_global_library.vm'
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro :  VM library template
> > macro registration complete.
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : allowInline = true :
> > VMs can be defined inline in templates
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : allowInlineToOverride
> > = false : VMs defined inline may NOT replace previous VM definitions Wed
> > Aug 10 14:07:22 BST 2005   [info] Velocimacro : allowInlineLocal = false
> > : VMs defined inline will be  global in scope if allowed.
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : messages on  : VM
> > system will output logging messages
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : autoload off  : VM
> > system will not automatically reload global library macros
> >Wed Aug 10 14:07:22 BST 2005   [info] Velocimacro : initialization
> > complete. Wed Aug 10 14:07:22 BST 2005   [info] Velocity successfully
> > started. Wed Aug 10 14:07:23 BST 2005   [info] ResourceManager : found
> >system_templates/editor/index.vm with loader
> >org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >Wed Aug 10 14:07:23 BST 2005   [info] ResourceManager : found
> >system_templates/editor/preview.vm with loader
> >org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >Wed Aug 10 14:07:23 BST 2005   [info] ResourceManager : found
> >user_templates/template07.vm with loader
> >org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >Wed Aug 10 14:07:23 BST 2005   [info] ResourceManager : found
> >user_templates/content.vm with loader
> >org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >
> >On Wed August 10 2005 2:02 pm, Jean Francois Chamard wrote:
> >>Hi,
> >>you don't need to #parse the vm file if you put it in velocimacro.library
> >>
> >>Did you check in your logs (velocity.log by default) if your macro
> >>(menu.vm) is initialized when your web app is starting?
> >>Perhaps you have an error in menu.vm and it fails to initialize
> >>
> >>Your call to your macro seems right though
> >>Jeff
> >>
> >>Andrew Mason wrote:
> >>>Hi Guys,
> >>>I too am having a little bit of a problem with the macros and i'm afraid
> >>> i didn't really understand much about how the file resource loaders
> >>> work when i looked at this page
> >>>http://jakarta.apache.org/velocity/developer-guide.html.
> >>>
> >>>I have a working macro defined in menu.vm.
> >>>
> >>>i've added
> >>>velocimacro.library = menu.vm
> >>>to my
> >>>velocity.properties.fileloader
> >>>
> >>>but it doesn't appear to find my macro.
> >>>
> >>>I the template I am just calling
> >>>#makemenu( $node "70%" 1)
> >>>
> >>>do i need to do a #parse("menu.vm") ?
> >>>
> >>>Thanks in advance
> >>>Andrew M
> >>>
> >>>On Wed July 6 2005 1:01 pm, E.R. van Es wrote:
> >>>>Hi Simon,
> >>>>
> >>>> tested this right away and it works excellent, many thanks here.
> >>>>
> >>>>Eric
> >>>>
> >>>>On Wed, 6 Jul 2005 12:41:47 +0100
> >>>>
> >>>>Simon Christian <simon@stoutstick.com> wrote:
> >>>>>Hi Eric,
> >>>>>
> >>>>>Your observations are correct, that the parsed-in macro won't be
> >>>>>available on the first request. If you want to use the macro within
> >>>>>multiple templates (as would typically be the case), you should add
a
> >>>>>line to your velocity.properties file:
> >>>>>
> >>>>>    velocimacro.library = macro.vm
> >>>>>
> >>>>>Velocity will look for that file in your usual macro path(s). There
> >>>>>are further options, which you can read about within the developer
> >>>>>guide: http://jakarta.apache.org/velocity/developer-guide.html
> >>>>>
> >>>>>- simon
> >>>>>
> >>>>>On 6 Jul 2005, at 12:09, E.R. van Es wrote:
> >>>>>>Hello,
> >>>>>>
> >>>>>> I use JBoss-4.0.1sp1 server, my application uses velocity-1.3.1.
> >>>>>>I use velocity to create the html pages, and have the following
two
> >>>>>>templates:
> >>>>>>(note: I simplified the code somewhat...)
> >>>>>>
> >>>>>>------- macro.vm --------
> >>>>>>#macro ( test $nr )
> >>>>>>   $nr
> >>>>>>#end
> >>>>>>-------- end macro.vm -------
> >>>>>>
> >>>>>>------- index.vm ---------
> >>>>>>#parse("macro.vm")
> >>>>>><html>
> >>>>>>   <body>
> >>>>>>#test(1)
> >>>>>>#test(2)
> >>>>>>   </body>
> >>>>>></html>
> >>>>>>------ end index.vm -----
> >>>>>>
> >>>>>>Now I deploy this application on JBoss and open the index page
> >>>>>>through the servlet.  The very first time I open the page, I
get
> >>>>>>this output:
> >>>>>>--- output ----
> >>>>>>#test(1)
> >>>>>>#test(2)
> >>>>>>--- end output ---
> >>>>>>
> >>>>>>now when I refresh the page, I get:
> >>>>>>--- output ---
> >>>>>>1
> >>>>>>2
> >>>>>>--- output ---
> >>>>>>
> >>>>>>so the first time it won't execute the macro...?  This only happens
> >>>>>>the first time opening the page after a new deployement.  When
I
> >>>>>>copy the whole macro into the index.vm file it works, also the
> >>>>>>first time after deployement, but I need the macro in more files,
> >>>>>>so I want the macro in a seperate file.
> >>>>>>
> >>>>>>Looking forward to any reply,
> >>>>>>Eric
> >>>>>>
> >>>>>>---------------------------------------------------------------------
> >>>>>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>>>>>For additional commands, e-mail:
> >>>>>> velocity-user-help@jakarta.apache.org
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>>>>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>>>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org

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


Mime
View raw message