You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Vermeulen Vermeulen <VV...@OLDMUTUAL.com> on 2001/02/12 06:55:29 UTC

Want to get going !!!

Hi there 

I am trying to get Velocity running on my PC.

But when I try to execute the Example class I get an exception in the
velocity.log file.

The command being used for executing :	java -cp .;../bin/velocity-0.72.jar
Example example.vm  > output

In the output file java.lang.NullPointerException are displayed.
The example.vm file are in the same directory from where I issue the above
command ?

any ideas ?

regards

Andre Vermeulen

The Log File after execution :

Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Default Properties File:
org\apache\velocity\runtime\defaults\velocity.properties
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
template.loader = org.apache.velocity.runtime.loader.FileTemplateLoader
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
template.path = .
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
template.encoding = 8859_1
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
runtime.log = velocity.log
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
counter.initial.value = 1
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
default.contentType = text/html
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
template.modificationCheckInterval = 2
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
counter.name = velocityCount
Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
template.cache = false
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Log file being used is:
C:\java\Apache-Velocity-20010211\examples\velocity.log
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resource Loader Instantiated:
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resources Loaded From:
C:\java\Apache-Velocity-20010211\examples\.
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resource Loader Initialized.
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Literal
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Macro
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Parse
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Include
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Foreach
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Created: 20 parsers.
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Velocimacro : initialization
starting.
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Velocimacro : adding VMs from
global VM library template : VM_global_library.vm
Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Attempting to find
VM_global_library.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
#quietnull( a ) : source = VM_global_library.vm
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
#recurse( a ) : source = VM_global_library.vm
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
#callrecurse( ) : source = VM_global_library.vm
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
#testbool( b ) : source = VM_global_library.vm
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : global VM library
template macro registration complete.
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : no local VM
library template used.
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : allowInline = true
: VMs can be defined inline in templates
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro :
allowInlineToOverride = false : VMs defined inline may NOT replace previous
VM definitions
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : allowInlineLocal =
false : VMs defined inline will be  global in scope if allowed.
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : messages on  : VM
system will output information messages
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : initialization
complete.
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocity successfully started.
Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Attempting to find example.vm
with org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Feb 12 07:28:24 GMT+02:00 2001  [error] Parser Exception: example.vm :
org.apache.velocity.runtime.parser.ParseException: Encountered "$this" at
line 3, column 6.
Was expecting:
    "(" ...
    
	at java.lang.Throwable.<init>(Throwable.java:96)
	at java.lang.Exception.<init>(Exception.java:44)
	at
org.apache.velocity.runtime.parser.ParseException.<init>(ParseException.java
:31)
	at
org.apache.velocity.runtime.parser.Parser.generateParseException(Parser.java
:3161)
	at
org.apache.velocity.runtime.parser.Parser.jj_consume_token(Parser.java:3045)
	at
org.apache.velocity.runtime.parser.Parser.SetDirective(Parser.java:1436)
	at
org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:268)
	at
org.apache.velocity.runtime.parser.Parser.process(Parser.java:218)
	at org.apache.velocity.runtime.parser.Parser.parse(Parser.java:78)
	at org.apache.velocity.runtime.Runtime.parse(Runtime.java:567)
	at org.apache.velocity.Template.process(Template.java:116)
	at
org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceMan
ager.java:279)
	at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:635)
	at Example.<init>(Example.java:98)
	at Example.main(Example.java:138)

Mon Feb 12 07:28:24 GMT+02:00 2001  [error] java.lang.Exception: Can't find
example.vm!


Re: Want to get going !!!

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Vermeulen Vermeulen wrote:
> 
> Hi there
> 
> I am trying to get Velocity running on my PC.
> 
> But when I try to execute the Example class I get an exception in the
> velocity.log file.
> 
> The command being used for executing :  java -cp .;../bin/velocity-0.72.jar
> Example example.vm  > output
> 
> In the output file java.lang.NullPointerException are displayed.
> The example.vm file are in the same directory from where I issue the above
> command ?
> 
> any ideas ?

Yes, and our apologies in advance.

The examples were not kept up to date with the Velocity syntax. The
problem is that the #set() directive has an updated syntax and the
template was out of sync.

This was all fixed yesterday, so if you get a new nightly snapshot, or
re-fetch from CVS, all will be fine.

All you will have to do is 

1) get a new CVS tree
2) run build-velocity.bat examples   in the build directory
3) go play with the examples.

Again, our apologies, and thanks for using Velocity :)

geir



> regards
> 
> Andre Vermeulen
> 
> The Log File after execution :
> 
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Default Properties File:
> org\apache\velocity\runtime\defaults\velocity.properties
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> template.loader = org.apache.velocity.runtime.loader.FileTemplateLoader
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> template.path = .
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> template.encoding = 8859_1
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> runtime.log = velocity.log
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> counter.initial.value = 1
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> default.contentType = text/html
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> template.modificationCheckInterval = 2
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> counter.name = velocityCount
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info]    ** Property Override :
> template.cache = false
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Log file being used is:
> C:\java\Apache-Velocity-20010211\examples\velocity.log
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resource Loader Instantiated:
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resources Loaded From:
> C:\java\Apache-Velocity-20010211\examples\.
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Resource Loader Initialized.
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
> org.apache.velocity.runtime.directive.Literal
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
> org.apache.velocity.runtime.directive.Macro
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
> org.apache.velocity.runtime.directive.Parse
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
> org.apache.velocity.runtime.directive.Include
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Loaded Pluggable Directive:
> org.apache.velocity.runtime.directive.Foreach
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Created: 20 parsers.
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Velocimacro : initialization
> starting.
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Velocimacro : adding VMs from
> global VM library template : VM_global_library.vm
> Mon Feb 12 07:28:23 GMT+02:00 2001   [info] Attempting to find
> VM_global_library.vm with
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
> #quietnull( a ) : source = VM_global_library.vm
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
> #recurse( a ) : source = VM_global_library.vm
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
> #callrecurse( ) : source = VM_global_library.vm
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : added new VM :
> #testbool( b ) : source = VM_global_library.vm
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : global VM library
> template macro registration complete.
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : no local VM
> library template used.
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : allowInline = true
> : VMs can be defined inline in templates
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro :
> allowInlineToOverride = false : VMs defined inline may NOT replace previous
> VM definitions
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : allowInlineLocal =
> false : VMs defined inline will be  global in scope if allowed.
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : messages on  : VM
> system will output information messages
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocimacro : initialization
> complete.
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Velocity successfully started.
> Mon Feb 12 07:28:24 GMT+02:00 2001   [info] Attempting to find example.vm
> with org.apache.velocity.runtime.resource.loader.FileResourceLoader
> Mon Feb 12 07:28:24 GMT+02:00 2001  [error] Parser Exception: example.vm :
> org.apache.velocity.runtime.parser.ParseException: Encountered "$this" at
> line 3, column 6.
> Was expecting:
>     "(" ...
> 
>         at java.lang.Throwable.<init>(Throwable.java:96)
>         at java.lang.Exception.<init>(Exception.java:44)
>         at
> org.apache.velocity.runtime.parser.ParseException.<init>(ParseException.java
> :31)
>         at
> org.apache.velocity.runtime.parser.Parser.generateParseException(Parser.java
> :3161)
>         at
> org.apache.velocity.runtime.parser.Parser.jj_consume_token(Parser.java:3045)
>         at
> org.apache.velocity.runtime.parser.Parser.SetDirective(Parser.java:1436)
>         at
> org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:268)
>         at
> org.apache.velocity.runtime.parser.Parser.process(Parser.java:218)
>         at org.apache.velocity.runtime.parser.Parser.parse(Parser.java:78)
>         at org.apache.velocity.runtime.Runtime.parse(Runtime.java:567)
>         at org.apache.velocity.Template.process(Template.java:116)
>         at
> org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceMan
> ager.java:279)
>         at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:635)
>         at Example.<init>(Example.java:98)
>         at Example.main(Example.java:138)
> 
> Mon Feb 12 07:28:24 GMT+02:00 2001  [error] java.lang.Exception: Can't find
> example.vm!

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity