velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Christian <si...@stoutstick.com>
Subject Re: ClassCastException ruining my fun
Date Tue, 12 Apr 2005 17:28:55 GMT


N J Higgs wrote:
> The odd thing is I haven't specified a velocity.properties file, and have been
> relying on the default. The
> org\apache\velociy\runtime\defaults\velocity.properties file seems to be in
> order.
> While experimenting I've found that if I set the offending property in the code
> using Properties.setProperty(), then another property causes a similar
> exception, like so:
> 
> javax.servlet.ServletException: Error initializing Velocity:
> java.lang.ClassCastException: 'modificationCheckInterval' doesn't map to a Long
> object
> 
> It seems that wherever these property settings are coming from, the last word in
> the property identifier is being obtained instead of the value. Anyone know why
> this would happen?
> 

That's simply how the error is reported from the ExtendedProperties 
class - including the key name rather than the value.

What you're seeing might actually suggest that it can't find the default 
velocity.properties at all, though I'd have thought that would produce a 
warning.

- s

>>
>>It looks like your velocity.properties file has some errors in it. It 
>>would be helpful if you posted the contents of that file here, but at a 
>>wild guess you may have a line that looks like this:
>>
>>  file.resource.loader.cache = {something other than a boolean}
>>
>>, where it should look like:
>>
>>  file.resource.loader.cache = true
>>
>>Alternatively it could be whitespace after the end of a similar property 
>>  entry (not sure how the o.a.c.c.ExtendedProperties class deals with 
>>that but java.util.Properties doesn't like it).
>>
>>I'm somewhat surprised that it only fails intermittently, but all may 
>>become clear..
>>
>>- simon
>>
>>N J Higgs wrote:
>>
>>>Hello,
>>>
>>>My VelocityServlets are intermittently failing due to a ClassCastExeption.
>>
>>The
>>
>>>Stack trace is appended to the end of this message. Does anyone know
>>
>>what's
>>
>>>going wrong?
>>>
>>>Thanks,
>>>N
>>>
>>>exception 
>>>
>>>javax.servlet.ServletException: Error initializing Velocity:
>>>java.lang.ClassCastException: 'cache' doesn't map to a Boolean object
>>>	at
>>>

---------------------------------------------------------------------
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