Paul Nicolucci created MYFACES-3594:
---------------------------------------

             Summary: ClassCastException after application restart due to 
UIViewParameter Renderer Cacheing
                 Key: MYFACES-3594
                 URL: https://issues.apache.org/jira/browse/MYFACES-3594
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.14
         Environment: WebSphere Application Server Version 8.0.  
            Reporter: Paul Nicolucci


The following exception can occur after an application restart:

javax.faces.FacesException: java.lang.ClassCastException: 
org.apache.myfaces.extensions.validator.core.storage.DefaultRendererInterceptorPropertyStorage
 incompatible with 
org.apache.myfaces.extensions.validator.core.storage.RendererInterceptorPropertyStorage
        at 
org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
        at 
org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:191)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at 
org.apache.myfaces.extensions.validator.core.startup.ExtValLifecycleWrapper.execute(ExtValLifecycleWrapper.java:61)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
        at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
        at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
        at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
        at 
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at 
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3704)
        at 
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at 
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
        at 
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
        at 
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
        at 
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
        at 
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
        at 
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
        at 
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
        at 
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at 
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at 
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at 
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
Caused by: java.lang.ClassCastException: 
org.apache.myfaces.extensions.validator.core.storage.DefaultRendererInterceptorPropertyStorage
 incompatible with 
org.apache.myfaces.extensions.validator.core.storage.RendererInterceptorPropertyStorage
        at 
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.getRendererInterceptorPropertyStorage(AbstractValidationInterceptor.java:477)
        at 
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.setRendererInterceptorProperties(AbstractValidationInterceptor.java:456)
        at 
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.beforeGetConvertedValue(AbstractValidationInterceptor.java:166)
        at 
org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.getConvertedValue(ExtValRendererWrapper.java:361)
        at 
javax.faces.component.UIViewParameter.getConvertedValue(UIViewParameter.java:248)
        at javax.faces.component.UIInput.validate(UIInput.java:556)
        at javax.faces.component.UIInput.processValidators(UIInput.java:247)
        at 
javax.faces.component.UIViewParameter.processValidators(UIViewParameter.java:218)
        at 
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1234)
        at 
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1234)
        at 
javax.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1326)
        at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:75)
        at 
javax.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIViewRoot.java:1401)
        at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1282)
        at 
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:758)
        at 
org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:34)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
        ... 25 more

The exception occurred because the UIViewParameter.java was holding on to it's 
renderer because it's a static variable.  This cause a few problems:

1) Since WebSphere ships MyFaces in the runtime more than one application is 
using this Static variable ( unlike when JSF is bundled within the application 
), so each application is using the same renderer.

2) The renderer was not being released during a restart of the application so 
one from a different classloader was being used causing the ClassCastException

3) Since UIViewParameter is within the API we could not just add a method to 
clean up the render, so I had to use the reflection API to make the call into a 
private static method.

I've attached a patch for this issue.  Please review and let me know your 
thoughts.  I've tested this and have had a customer also verify that it solves 
the issue they were seeing.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to