myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Slobodyanik (JIRA)" <>
Subject [jira] Created: (MYFACES-1354) Obsolete Application instance is used by expressions from cache of ValueBindingImpl
Date Thu, 06 Jul 2006 12:34:29 GMT
Obsolete Application instance is used by expressions from cache of  ValueBindingImpl 

         Key: MYFACES-1354
     Project: MyFaces Core
        Type: Bug

    Versions: 1.1.3, 1.1.5-SNAPSHOT    
 Environment: JBoss 4.0.4.GA
    Reporter: Alexander Slobodyanik
    Priority: Minor

I'm using custom PropertyResolver and it works fine until first redeployment of web application.
After that, it throws ClassCastException's. I've found out, that while new PropertyResolver
instance is created during every deployment, for every EL expression evaluation that instance
is used, which was used for it's first evaluation. So the source of linkage errors is that
classes of objects, passed to PropertyResolver instance, were loaded by different classloaders
(for each of web app deployments).

After searching the source code I've found the source of problem: static BiLevelCacheMap s_expressionCache
in ValueBindingImpl. It stores expressions, parsed from strings by ELParserHelper, and during
parsing link to current Application is passed  to these expressions:

private static void replaceSuffixes(ComplexValue complexValue)
        Application application = FacesContext.getCurrentInstance()

        List suffixes = complexValue.getSuffixes();
        for (int i = 0, len = suffixes.size(); i < len; i++)
            ValueSuffix suffix = (ValueSuffix) suffixes.get(i);
            if (suffix instanceof PropertySuffix)
                if (suffix instanceof MyPropertySuffix)
                    throw new IllegalStateException(
                        "Suffix is MyPropertySuffix and must not be");

                suffixes.set(i, new MyPropertySuffix((PropertySuffix) suffix,

Then, once some EL expression in JSP page was first evaluated, current Application instance
(and, accordingly, its PropertyResolver instance) will be used for all subsequent evaluations
of the same expression, even after redeployment of web app and new Application intance creation.

I can workaround this issue by using code like this: 

public Object getValue(Object base, Object property) throws EvaluationException, PropertyNotFoundException
        javax.faces.el.PropertyResolver actual = 
        if (this != actual) return actual.getValue(base, property);

at the start of each methos of PropertyResolver.


This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message