myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3720) [restoreView/restoreState] java.lang.ClassCastException: java.util.HashMap cannot be cast to javax.faces.convert.Converter
Date Mon, 13 May 2013 17:27:16 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13656148#comment-13656148
] 

Leonardo Uribe commented on MYFACES-3720:
-----------------------------------------

I have checked the problem in deep and my opinion is the problem is not in the converter (you
should not worry about how converter instances are instantiated. It does not matter if is
a singleton or if it is created multiple times, the impact in performance is minimal). Instead,
the stack trace shows in some place inside the code there is a desynchronization between the
state and the way facelets algorithm is generated. 

The algorithm in myfaces is ok, both the one that handles the state and the one that generated
unique ids in facelets. 

With the information provided I was able to track down the issue to these lines in pf_ViewAll.xhtml

                    <p:tab title="Payment/Status">
                        <ui:include src="/orders/pf_ViewPaymentStatus.xhtml"/>
                    </p:tab>

                    <p:tab title="Other">
                        <ui:include src="/orders/pf_ViewOther.xhtml"/>
                    </p:tab>

                    <p:tab title="Attractions">
The id for "Other" link in p:tab is ordersViewForm:orderViewTabView:j_id_b_1_4g and the id
for "Attractions" link is ordersViewForm:orderViewTabView:j_id_b_1_4t

Since the problematic component is at ordersViewForm:orderViewTabView:j_id_b_1_4q_1 , I suppose
there is something inside 

/orders/pf_ViewOther.xhtml

That is causing the problem. Since the id generation start a new "_", you should take a look
at the first occurrence of c:if , ui:include src="#{...}", c:choose or c:forEach. Probably
an use of <c:forEach /> tag could cause the problem, because it is the only tag that
can desynchronize the state (c:forEach has some issues that cause a lot of trouble as described
in issues like).

My suggestion is avoid all use of c:forEach tag. See MYFACES-3570 and MYFACES-3389 for details.
You can also try to comment the code inside that facelet to see what's the code that is causing
trouble. 

Please check /orders/pf_ViewOther.xhtml or let us know what's inside this facelet tag.

For now I'm sure it is not a myfaces issue, but I'll keep this issue open until we can find
what's going on.
                
> [restoreView/restoreState] java.lang.ClassCastException: java.util.HashMap cannot be
cast to javax.faces.convert.Converter
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3720
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3720
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.10, 2.1.11
>         Environment: 1. TomEE 1.6.0 snapshot (2013-04-29) which includes MyFaces 2.1.11
> 2. PrimeFaces 3.5 and PrimeFaces 4.0 snapshot
>            Reporter: Howard W. Smith, Jr.
>   Original Estimate: 28h
>  Remaining Estimate: 28h
>
> Originally reported as OmniFaces issue # 167 (please take a look at this, as I attached
some files there in OmniFaces issue tracker)
> https://code.google.com/p/omnifaces/issues/detail?id=167
> OmniFaces response was the following:
> Project Member #3 balusc
> This problem is indeed not related to o:enableRestorableView. The only occurrence in
the stack trace is just the delegation to super (i.e. the process continues less or more as
if the o:enableRestorableView was never involved):
>     UIViewRoot restoredView = super.restoreView(context, viewId);
> Below is stack trace with TomEE 1.6.0 (2013-04-29), myFaces 2.1.11, and PrimeFaces 4.0
snapshot. Is this a MyFaces bug or user error?
> May 09, 2013 8:06:54 AM org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/mcmsweb]
threw exception [Error restoring component: ordersViewForm:orderViewTabView:j_id_b_1_4q_1]
with root cause
> java.lang.ClassCastException: java.util.HashMap cannot be cast to javax.faces.convert.Converter
> 	at javax.faces.component.UIOutput.restoreState(UIOutput.java:248)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:687)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreStateFromMap(DefaultFaceletsStateManagementStrategy.java:706)
> 	at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreView(DefaultFaceletsStateManagementStrategy.java:340)
> 	at org.apache.myfaces.application.StateManagerImpl.restoreView(StateManagerImpl.java:129)
> 	at org.apache.myfaces.shared.view.ViewDeclarationLanguageBase.restoreView(ViewDeclarationLanguageBase.java:106)
> 	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.restoreView(FaceletViewDeclarationLanguage.java:2118)
> 	at org.apache.myfaces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:300)
> 	at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:83)
> 	at org.omnifaces.viewhandler.RestorableViewHandler.restoreView(RestorableViewHandler.java:66)
> 	at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:83)
> 	at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:127)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> 	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> 	at org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:148)
> 	at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> 	at pf.LoginFilter.doFilter(LoginFilter.java:244)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> 	at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
> 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> 	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
> 	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
> 	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:722)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message