You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2012/12/31 13:58:22 UTC

Re: Odd observation during debugging

Nathan,

On 7/11/12 12:28 PM, Nathan Bubna wrote:
> Just set:
> directive.if.tostring.nullcheck = false

We just went into production last night after testing in this
configuration for months, and we're getting this bizarre error message
that filled-up our logs files and the whole disk on the server.

Obviously, the root cause is at the bottom.:

INFO:  Velocity  [error] Could not initialize VelocityEngine -
org.apache.veloci
ty.exception.VelocityException: Velocimacro : Error using VM library :
/WEB-INF/
VM_global_library.vm
org.apache.velocity.exception.VelocityException: Velocimacro : Error
using VM li
brary : /WEB-INF/VM_global_library.vm
        at
org.apache.velocity.runtime.VelocimacroFactory.initVelocimacro(Veloci
macroFactory.java:219)
        at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java
:274)
...
Caused by: org.apache.velocity.exception.VelocityException: Exception
thrown pro
cessing Template /WEB-INF/VM_global_library.vm
        at org.apache.velocity.Template.process(Template.java:164)
        at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource
(ResourceManagerImpl.java:437)
        at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
ResourceManagerImpl.java:352)
        at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstan
ce.java:1533)
        at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstan
ce.java:1514)
        at
org.apache.velocity.runtime.VelocimacroFactory.initVelocimacro(Veloci
macroFactory.java:202)
        ... 28 more

Caused by: java.lang.ClassCastException:
'directive.if.tostring.nullcheck' doesn't map to a Boolean object
        at
org.apache.commons.collections.ExtendedProperties.getBoolean(Extended
Properties.java:1190)
        at
org.apache.commons.collections.ExtendedProperties.getBoolean(Extended
Properties.java:1157)
        at
org.apache.velocity.runtime.RuntimeInstance.getBoolean(RuntimeInstanc
e.java:1822)
        at
org.apache.velocity.runtime.parser.node.ASTReference.init(ASTReferenc
e.java:141)
        at
org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.ja
va:309)
        at
org.apache.velocity.runtime.parser.node.ASTDirective.init(ASTDirectiv
e.java:95)
        at
org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.ja
va:309)
        at org.apache.velocity.Template.initDocument(Template.java:227)
        at org.apache.velocity.Template.process(Template.java:135)
        ... 33 more

I'm going to temporarily remove this directive to get back up and
running, and I'll be looking at the code to see what's going on. If
anyone can make a suggestion in the meantime, I'm all ears.

I'm running Velocity 1.7 and Velocity Tools 2.0 with a few extra patches.

Thanks,
-chris


Re: Odd observation during debugging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
All,

On 12/31/12 7:58 AM, Christopher Schultz wrote:
> Nathan,
> 
> On 7/11/12 12:28 PM, Nathan Bubna wrote:
>> Just set:
>> directive.if.tostring.nullcheck = false
> 
> We just went into production last night after testing in this
> configuration for months, and we're getting this bizarre error message
> that filled-up our logs files and the whole disk on the server.
> 
> [...]
>
> Caused by: java.lang.ClassCastException:
> 'directive.if.tostring.nullcheck' doesn't map to a Boolean object

So this turned out to be a birazzely-merged properties file that
contained these lines:

# Turn off template re-loading
webapp.resource.loader.modificationCheckInterval=0
<<<<<<< .mine

# Disable the use or toString to determine 'truth' of references
directive.if.tostring.nullcheck=false
=======

# Set output encoding
output.encoding=UTF-8

# Disable convert-to-string for truth-checking in #if directive
directive.if.tostring.nullcheck=false
>>>>>>> .r11696

So, for whatever reason, the above confused the heck out of either the
property-file parser or the code that tries to test the peroperty's value.

Sor, this was entirely our fault and had nothing to do with Velocity per
se though it would have been nice if an insane value had issued a single
ERROR or WARN and then silently used the default rather than spewing
gigabytes of stack traces ;)

-chris