Re: ClassCastException and Server Crash when using MruCacheStorage

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Tuesday, March 22, 2011, 7:38:32 PM, Ram Palagummi wrote:

> Hi,
>
> We verified the possibility of multiple versions and I can guarantee
> that there is only one version (2.3.10) deployed in production. I
> did respond with stack trace we currently have.

What I have seen didn't contain any stack traces, not even line
numbers.

> Could you please let me know what error handler could help provide
> additional stack trace on FreeMarker class files?

Most certainly it's not in the hands of FreeMarker. It just throws a
standard Java exception, then outside something catches that and that
this is responsible to log it with proper details and like.
FreeMarker's error handlers can change that, but they have only role
if the template is already executing, which is certainly not the case
here (as the error seems to occurs earlier, when you try to get the
template).

> Regarding the 404s, I agree that FreeMarker doesn't throw 404s but
> the application is. However, the root cause seems to be with
> FreeMarker when it is looking up for requested template (in our case
> its the html file) within the MruCacheStorage and throwing the error
> which the application interprets as 404 to the end user.  

Of course the main issue is that ClassCastException. What I'm saying
is that it should result in a 500, not a 404. Not even missing
templates should generate 404 in most web applications, since
(usually) it's not the existence of template that "creates" the URL.

> Regards
> Ram 
>
>
> From: Daniel Dekany <[email protected]>
> To: Ram Palagummi <[email protected]>
> Cc: [email protected]
> Sent: Tue, March 22, 2011 10:20:09 AM
> Subject: Re: [FreeMarker-user] ClassCastException and Server Crash when using MruCacheStorage
>
> Monday, March 21, 2011, 7:32:35 PM, Ram Palagummi wrote:
>
>> Hi,
>>
>> I am an architect from EMC corporation and we have been using
>> FreeMarker for rendering our emc.com and few other application web
>> pages. We deployed new EMC.com towards the end of 2007 and the
>> FreeMarker version we went live with is 2.3.10.
>>
>> We have been noticing that anytime  MruCacheStorage (strong = 0 and
>> soft=500 or any other settings) is turned on for template caching,
>> we are getting the following error and the servers have to be
>> bounced in order to fix the problem. 
>>
>> ERROR while processing freemarker
>> template:java.lang.CLassCastException :
>> freemarker.cache.MruCacheStorage$MruReference.
>
> Rather strange. So, as Attila said, you should send a full
> stack-trace. Any change that you have multiple freemarker.jar-s of
> different versions in your class path?
>
>> Additionally, we are seeing the intermittent 404 issues when
>> freemarker is trying to load template from its cache causing panic within our user community.
>
> There is something strange about the Web application framework there.
> FreeMarker itself doesn't generate 404 or any other HTTP error
> message, it just throws exceptions. In most situations an issue with a
> template should result in 500. Thus the visitors know that the page
> haven't been removed or something, "only" there's some problem on the
> server.
>
>> Its critical that we resolve this issue right away. Please let us
>> know if this is a known issue and has a fix. 
>>
>> Thanks
>> Solution Architect 
>> EMC Corporation
>>
>

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.