You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wojtek K <wo...@wp.pl> on 2012/03/19 22:14:59 UTC
Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException during
RV(1) )
Hello!
Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we have problems with ui:repeat).
With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
Caused by: java.lang.ClassCastException: org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to javax.faces.event.ComponentSystemEventListener
at javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
at javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
Our views are very complicated so i can't find what is wrong.
Can this be bug in myfaces? or it is problem in ours views?
web.xml
<context-param>
<param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
thanks
wojtek
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException
during RV(1) )
Posted by Wojtek K <wo...@wp.pl>.
Hello.
Now I am able to reproduce this stacktrace with small view.
layout.xhtml
</h:head>
<h:body>
<h:form>
<ui:insert name="page-content">
</ui:insert>
</h:form>
</h:body>
</html>
sample.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
>
<ui:composition template="/templates/layout.xhtml">
<ui:define name="page-content">
<h:commandLink value="test link"/>
</ui:define>
</ui:composition>
</html>
bad_view.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<c:if test="#{request !=null}">
<ui:include src="sample.xhtml"></ui:include>
</c:if>
</html>
if yout type in browser localhost:8080/test/bad_view.xhtml and click test_link on page the error occurs.
If you remove <h:outputStylesheet library="css" name="test_css.css"/>
from layout.xhtml problem dosen't occurs.
Another solution is to wrapp c:if tag with for example h:outputText and problem is gone too.
In our views there aren't any <h:outputStylesheet or h:outputScript tags but we have same stacktrace.
I have eliminated all views like bad_view.xhtml in our project but error still occurs.
I have no idea what is wrong :/
PS
bad_view.xhtml i correct in terms of using jsf?
wojtek
Dnia 20-03-2012 o godz. 17:05 Leonardo Uribe napisał(a):
> Hi
>
> I checked the stacktrace and the code looks good. There are not recent
> changes that could affect in that location.
>
> The issue should be caused by a listener that is not restored
> correctly. Take a look at your <f:event listener="..", @ListenerFor
> annotations. One suposition is you have registered a listener in a
> renderer using @ListenerFor or you have registered programatically a
> renderer as a listener, but the renderer does not belong to the same
> component and the restore code (see the line for restore renderer):
>
> //Full restore
> listenerCapability = (Integer) values[2];
>
> if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
> {
> listener = UIComponent.getCurrentComponent(context);
> }
> else if ((listenerCapability & LISTENER_TYPE_RENDERER) != 0)
> {
> listener = (ComponentSystemEventListener)
>
> UIComponent.getCurrentComponent(context).getRenderer(context);
> }
> else
> {
> listener = (ComponentSystemEventListener)
>
> UIComponentBase.restoreAttachedState(context, values[1]);
> }
>
> will cause a class cast exception. If that's the case, please let us
> know the use case to add the additional check and force save the
> renderer class in such cases. In other case, to solve this issue it is
> necessary provide a test case.
>
> regards,
>
> Leonardo Uribe
>
> 2012/3/20 Werner Punz <we...@gmail.com>:
> > Best bet is to file a bugreport to get this fixed asap.
> >
> > Werner
> >
> >
> > Am 19.03.12 22:14, schrieb Wojtek K:
> >
> >> Hello!
> >>
> >>
> >>
> >> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
> >> have problems with ui:repeat).
> >>
> >>
> >>
> >> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
> >>
> >>
> >>
> >> Caused by: java.lang.ClassCastException:
> >> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
> >> javax.faces.event.ComponentSystemEventListener
> >> at
> >> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
> >> at
> >> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
> >> at
> >> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >> at
> >> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
> >> at
> >> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
> >> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
> >> at
> >> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
> >> at
> >> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
> >> at
> >> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
> >> at
> >> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >> at
> >> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
> >> at
> >> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >>
> >>
> >>
> >> Our views are very complicated so i can't find what is wrong.
> >>
> >> Can this be bug in myfaces? or it is problem in ours views?
> >>
> >>
> >>
> >> web.xml
> >>
> >>
> >>
> >> <context-param>
> >>
> >> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> >> <param-value>true</param-value>
> >> </context-param>
> >>
> >> <context-param>
> >>
> >> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> >> <param-value>true</param-value>
> >> </context-param>
> >>
> >> <context-param>
> >> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
> >> <param-value>true</param-value>
> >> </context-param>
> >>
> >>
> >> thanks
> >>
> >>
> >>
> >> wojtek
> >>
> >>
> >>
> >
> >
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException
during RV(1) )
Posted by Wojtek K <wo...@wp.pl>.
Hello!
I've created bug in jira
MYFACES-3508
wojtek
Dnia 20-03-2012 o godz. 18:28 Leonardo Uribe napisał(a):
> Hi
>
> Ok, I found the bug. It was related to some optimization done in
> rendererType. In few words, this field should be restored before
> system event listeners, so
> UIComponent.getCurrentComponent(context).getRenderer(context) can
> restore the right renderer.
>
> The solution is just reorganize UIComponentBase.restoreState. Please
> create an issue in:
>
> https://issues.apache.org/jira/browse/MYFACES
>
> And I'll commit the solution as soon as the issue is created. Thanks
> for your help solving this issue, it is very helpful to receive
> feedback from our snapshot artifacts.
>
> regards,
>
> Leonardo Uribe
>
> 2012/3/20 Wojtek K <wo...@wp.pl>:
> > Thanks for adivce Leonardo.
> > This helps (for my test).
> > Later i check with our "real" project.
> >
> > wojtek
> >
> >
> >
> > Dnia 20-03-2012 o godz. 17:09 Leonardo Uribe napisał(a):
> >> Hi
> >>
> >> I almost forget to say one advice. Please try to remove:
> >>
> >> <context-param>
> >>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> >> <param-value>true</param-value>
> >> </context-param>
> >>
> >> <context-param>
> >>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> >> <param-value>true</param-value>
> >> </context-param>
> >>
> >> so org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS will set to auto
> >> mode. Recent changes in 2.1.6 / 2.1.7 has improved that part. Maybe
> >> your code will work doing that.
> >>
> >> regards,
> >>
> >> Leonardo Uribe
> >>
> >> 2012/3/20 Leonardo Uribe <lu...@gmail.com>:
> >> > Hi
> >> >
> >> > I checked the stacktrace and the code looks good. There are not recent
> >> > changes that could affect in that location.
> >> >
> >> > The issue should be caused by a listener that is not restored
> >> > correctly. Take a look at your <f:event listener="..", @ListenerFor
> >> > annotations. One suposition is you have registered a listener in a
> >> > renderer using @ListenerFor or you have registered programatically a
> >> > renderer as a listener, but the renderer does not belong to the same
> >> > component and the restore code (see the line for restore renderer):
> >> >
> >> > //Full restore
> >> > listenerCapability = (Integer) values[2];
> >> >
> >> > if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
> >> > {
> >> > listener = UIComponent.getCurrentComponent(context);
> >> > }
> >> > else if ((listenerCapability & LISTENER_TYPE_RENDERER) !=
> >> 0)
> >> > {
> >> > listener = (ComponentSystemEventListener)
> >> >
> >> > UIComponent.getCurrentComponent(context).getRenderer(context);
> >> > }
> >> > else
> >> > {
> >> > listener = (ComponentSystemEventListener)
> >> >
> >> > UIComponentBase.restoreAttachedState(context, values[1]);
> >> > }
> >> >
> >> > will cause a class cast exception. If that's the case, please let us
> >> > know the use case to add the additional check and force save the
> >> > renderer class in such cases. In other case, to solve this issue it is
> >> > necessary provide a test case.
> >> >
> >> > regards,
> >> >
> >> > Leonardo Uribe
> >> >
> >> > 2012/3/20 Werner Punz <we...@gmail.com>:
> >> >> Best bet is to file a bugreport to get this fixed asap.
> >> >>
> >> >> Werner
> >> >>
> >> >>
> >> >> Am 19.03.12 22:14, schrieb Wojtek K:
> >> >>
> >> >>> Hello!
> >> >>>
> >> >>>
> >> >>>
> >> >>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
> >> >>> have problems with ui:repeat).
> >> >>>
> >> >>>
> >> >>>
> >> >>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
> >> >>>
> >> >>>
> >> >>>
> >> >>> Caused by: java.lang.ClassCastException:
> >> >>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
> >> >>> javax.faces.event.ComponentSystemEventListener
> >> >>> at
> >> >>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >> >>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
> >> >>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
> >> >>> at
> >> >>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
> >> >>> at
> >> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >> >>> at
> >> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
> >> >>> at
> >> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >> >>>
> >> >>>
> >> >>>
> >> >>> Our views are very complicated so i can't find what is wrong.
> >> >>>
> >> >>> Can this be bug in myfaces? or it is problem in ours views?
> >> >>>
> >> >>>
> >> >>>
> >> >>> web.xml
> >> >>>
> >> >>>
> >> >>>
> >> >>> <context-param>
> >> >>>
> >> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> >> >>> <param-value>true</param-value>
> >> >>> </context-param>
> >> >>>
> >> >>> <context-param>
> >> >>>
> >> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> >> >>> <param-value>true</param-value>
> >> >>> </context-param>
> >> >>>
> >> >>> <context-param>
> >> >>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
> >> >>> <param-value>true</param-value>
> >> >>> </context-param>
> >> >>>
> >> >>>
> >> >>> thanks
> >> >>>
> >> >>>
> >> >>>
> >> >>> wojtek
> >> >>>
> >> >>>
> >> >>>
> >> >>
> >> >>
> >
> >
> >
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException during
RV(1) )
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
Ok, I found the bug. It was related to some optimization done in
rendererType. In few words, this field should be restored before
system event listeners, so
UIComponent.getCurrentComponent(context).getRenderer(context) can
restore the right renderer.
The solution is just reorganize UIComponentBase.restoreState. Please
create an issue in:
https://issues.apache.org/jira/browse/MYFACES
And I'll commit the solution as soon as the issue is created. Thanks
for your help solving this issue, it is very helpful to receive
feedback from our snapshot artifacts.
regards,
Leonardo Uribe
2012/3/20 Wojtek K <wo...@wp.pl>:
> Thanks for adivce Leonardo.
> This helps (for my test).
> Later i check with our "real" project.
>
> wojtek
>
>
>
> Dnia 20-03-2012 o godz. 17:09 Leonardo Uribe napisał(a):
>> Hi
>>
>> I almost forget to say one advice. Please try to remove:
>>
>> <context-param>
>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>> <context-param>
>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>> so org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS will set to auto
>> mode. Recent changes in 2.1.6 / 2.1.7 has improved that part. Maybe
>> your code will work doing that.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>> 2012/3/20 Leonardo Uribe <lu...@gmail.com>:
>> > Hi
>> >
>> > I checked the stacktrace and the code looks good. There are not recent
>> > changes that could affect in that location.
>> >
>> > The issue should be caused by a listener that is not restored
>> > correctly. Take a look at your <f:event listener="..", @ListenerFor
>> > annotations. One suposition is you have registered a listener in a
>> > renderer using @ListenerFor or you have registered programatically a
>> > renderer as a listener, but the renderer does not belong to the same
>> > component and the restore code (see the line for restore renderer):
>> >
>> > //Full restore
>> > listenerCapability = (Integer) values[2];
>> >
>> > if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
>> > {
>> > listener = UIComponent.getCurrentComponent(context);
>> > }
>> > else if ((listenerCapability & LISTENER_TYPE_RENDERER) !=
>> 0)
>> > {
>> > listener = (ComponentSystemEventListener)
>> >
>> > UIComponent.getCurrentComponent(context).getRenderer(context);
>> > }
>> > else
>> > {
>> > listener = (ComponentSystemEventListener)
>> >
>> > UIComponentBase.restoreAttachedState(context, values[1]);
>> > }
>> >
>> > will cause a class cast exception. If that's the case, please let us
>> > know the use case to add the additional check and force save the
>> > renderer class in such cases. In other case, to solve this issue it is
>> > necessary provide a test case.
>> >
>> > regards,
>> >
>> > Leonardo Uribe
>> >
>> > 2012/3/20 Werner Punz <we...@gmail.com>:
>> >> Best bet is to file a bugreport to get this fixed asap.
>> >>
>> >> Werner
>> >>
>> >>
>> >> Am 19.03.12 22:14, schrieb Wojtek K:
>> >>
>> >>> Hello!
>> >>>
>> >>>
>> >>>
>> >>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
>> >>> have problems with ui:repeat).
>> >>>
>> >>>
>> >>>
>> >>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
>> >>>
>> >>>
>> >>>
>> >>> Caused by: java.lang.ClassCastException:
>> >>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
>> >>> javax.faces.event.ComponentSystemEventListener
>> >>> at
>> >>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>> >>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
>> >>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
>> >>> at
>> >>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
>> >>> at
>> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>> >>> at
>> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
>> >>> at
>> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>> >>>
>> >>>
>> >>>
>> >>> Our views are very complicated so i can't find what is wrong.
>> >>>
>> >>> Can this be bug in myfaces? or it is problem in ours views?
>> >>>
>> >>>
>> >>>
>> >>> web.xml
>> >>>
>> >>>
>> >>>
>> >>> <context-param>
>> >>>
>> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
>> >>> <param-value>true</param-value>
>> >>> </context-param>
>> >>>
>> >>> <context-param>
>> >>>
>> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
>> >>> <param-value>true</param-value>
>> >>> </context-param>
>> >>>
>> >>> <context-param>
>> >>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
>> >>> <param-value>true</param-value>
>> >>> </context-param>
>> >>>
>> >>>
>> >>> thanks
>> >>>
>> >>>
>> >>>
>> >>> wojtek
>> >>>
>> >>>
>> >>>
>> >>
>> >>
>
>
>
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException
during RV(1) )
Posted by Wojtek K <wo...@wp.pl>.
Thanks for adivce Leonardo.
This helps (for my test).
Later i check with our "real" project.
wojtek
Dnia 20-03-2012 o godz. 17:09 Leonardo Uribe napisał(a):
> Hi
>
> I almost forget to say one advice. Please try to remove:
>
> <context-param>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> <param-value>true</param-value>
> </context-param>
>
> so org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS will set to auto
> mode. Recent changes in 2.1.6 / 2.1.7 has improved that part. Maybe
> your code will work doing that.
>
> regards,
>
> Leonardo Uribe
>
> 2012/3/20 Leonardo Uribe <lu...@gmail.com>:
> > Hi
> >
> > I checked the stacktrace and the code looks good. There are not recent
> > changes that could affect in that location.
> >
> > The issue should be caused by a listener that is not restored
> > correctly. Take a look at your <f:event listener="..", @ListenerFor
> > annotations. One suposition is you have registered a listener in a
> > renderer using @ListenerFor or you have registered programatically a
> > renderer as a listener, but the renderer does not belong to the same
> > component and the restore code (see the line for restore renderer):
> >
> > //Full restore
> > listenerCapability = (Integer) values[2];
> >
> > if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
> > {
> > listener = UIComponent.getCurrentComponent(context);
> > }
> > else if ((listenerCapability & LISTENER_TYPE_RENDERER) !=
> 0)
> > {
> > listener = (ComponentSystemEventListener)
> >
> > UIComponent.getCurrentComponent(context).getRenderer(context);
> > }
> > else
> > {
> > listener = (ComponentSystemEventListener)
> >
> > UIComponentBase.restoreAttachedState(context, values[1]);
> > }
> >
> > will cause a class cast exception. If that's the case, please let us
> > know the use case to add the additional check and force save the
> > renderer class in such cases. In other case, to solve this issue it is
> > necessary provide a test case.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> > 2012/3/20 Werner Punz <we...@gmail.com>:
> >> Best bet is to file a bugreport to get this fixed asap.
> >>
> >> Werner
> >>
> >>
> >> Am 19.03.12 22:14, schrieb Wojtek K:
> >>
> >>> Hello!
> >>>
> >>>
> >>>
> >>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
> >>> have problems with ui:repeat).
> >>>
> >>>
> >>>
> >>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
> >>>
> >>>
> >>>
> >>> Caused by: java.lang.ClassCastException:
> >>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
> >>> javax.faces.event.ComponentSystemEventListener
> >>> at
> >>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
> >>> at
> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
> >>> at
> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> >>> at
> >>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
> >>> at
> >>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
> >>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
> >>> at
> >>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
> >>> at
> >>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
> >>> at
> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
> >>> at
> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >>> at
> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
> >>> at
> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> >>>
> >>>
> >>>
> >>> Our views are very complicated so i can't find what is wrong.
> >>>
> >>> Can this be bug in myfaces? or it is problem in ours views?
> >>>
> >>>
> >>>
> >>> web.xml
> >>>
> >>>
> >>>
> >>> <context-param>
> >>>
> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> >>> <param-value>true</param-value>
> >>> </context-param>
> >>>
> >>> <context-param>
> >>>
> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> >>> <param-value>true</param-value>
> >>> </context-param>
> >>>
> >>> <context-param>
> >>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
> >>> <param-value>true</param-value>
> >>> </context-param>
> >>>
> >>>
> >>> thanks
> >>>
> >>>
> >>>
> >>> wojtek
> >>>
> >>>
> >>>
> >>
> >>
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException during
RV(1) )
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
I almost forget to say one advice. Please try to remove:
<context-param>
<param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
<param-value>true</param-value>
</context-param>
so org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS will set to auto
mode. Recent changes in 2.1.6 / 2.1.7 has improved that part. Maybe
your code will work doing that.
regards,
Leonardo Uribe
2012/3/20 Leonardo Uribe <lu...@gmail.com>:
> Hi
>
> I checked the stacktrace and the code looks good. There are not recent
> changes that could affect in that location.
>
> The issue should be caused by a listener that is not restored
> correctly. Take a look at your <f:event listener="..", @ListenerFor
> annotations. One suposition is you have registered a listener in a
> renderer using @ListenerFor or you have registered programatically a
> renderer as a listener, but the renderer does not belong to the same
> component and the restore code (see the line for restore renderer):
>
> //Full restore
> listenerCapability = (Integer) values[2];
>
> if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
> {
> listener = UIComponent.getCurrentComponent(context);
> }
> else if ((listenerCapability & LISTENER_TYPE_RENDERER) != 0)
> {
> listener = (ComponentSystemEventListener)
>
> UIComponent.getCurrentComponent(context).getRenderer(context);
> }
> else
> {
> listener = (ComponentSystemEventListener)
>
> UIComponentBase.restoreAttachedState(context, values[1]);
> }
>
> will cause a class cast exception. If that's the case, please let us
> know the use case to add the additional check and force save the
> renderer class in such cases. In other case, to solve this issue it is
> necessary provide a test case.
>
> regards,
>
> Leonardo Uribe
>
> 2012/3/20 Werner Punz <we...@gmail.com>:
>> Best bet is to file a bugreport to get this fixed asap.
>>
>> Werner
>>
>>
>> Am 19.03.12 22:14, schrieb Wojtek K:
>>
>>> Hello!
>>>
>>>
>>>
>>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
>>> have problems with ui:repeat).
>>>
>>>
>>>
>>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
>>>
>>>
>>>
>>> Caused by: java.lang.ClassCastException:
>>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
>>> javax.faces.event.ComponentSystemEventListener
>>> at
>>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
>>> at
>>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
>>> at
>>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>>> at
>>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
>>> at
>>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
>>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
>>> at
>>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
>>> at
>>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
>>> at
>>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
>>> at
>>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>>> at
>>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
>>> at
>>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>>>
>>>
>>>
>>> Our views are very complicated so i can't find what is wrong.
>>>
>>> Can this be bug in myfaces? or it is problem in ours views?
>>>
>>>
>>>
>>> web.xml
>>>
>>>
>>>
>>> <context-param>
>>>
>>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
>>> <param-value>true</param-value>
>>> </context-param>
>>>
>>> <context-param>
>>>
>>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
>>> <param-value>true</param-value>
>>> </context-param>
>>>
>>> <context-param>
>>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
>>> <param-value>true</param-value>
>>> </context-param>
>>>
>>>
>>> thanks
>>>
>>>
>>>
>>> wojtek
>>>
>>>
>>>
>>
>>
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException during
RV(1) )
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
I checked the stacktrace and the code looks good. There are not recent
changes that could affect in that location.
The issue should be caused by a listener that is not restored
correctly. Take a look at your <f:event listener="..", @ListenerFor
annotations. One suposition is you have registered a listener in a
renderer using @ListenerFor or you have registered programatically a
renderer as a listener, but the renderer does not belong to the same
component and the restore code (see the line for restore renderer):
//Full restore
listenerCapability = (Integer) values[2];
if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0)
{
listener = UIComponent.getCurrentComponent(context);
}
else if ((listenerCapability & LISTENER_TYPE_RENDERER) != 0)
{
listener = (ComponentSystemEventListener)
UIComponent.getCurrentComponent(context).getRenderer(context);
}
else
{
listener = (ComponentSystemEventListener)
UIComponentBase.restoreAttachedState(context, values[1]);
}
will cause a class cast exception. If that's the case, please let us
know the use case to add the additional check and force save the
renderer class in such cases. In other case, to solve this issue it is
necessary provide a test case.
regards,
Leonardo Uribe
2012/3/20 Werner Punz <we...@gmail.com>:
> Best bet is to file a bugreport to get this fixed asap.
>
> Werner
>
>
> Am 19.03.12 22:14, schrieb Wojtek K:
>
>> Hello!
>>
>>
>>
>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we
>> have problems with ui:repeat).
>>
>>
>>
>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
>>
>>
>>
>> Caused by: java.lang.ClassCastException:
>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to
>> javax.faces.event.ComponentSystemEventListener
>> at
>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
>> at
>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
>> at
>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
>> at
>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
>> at
>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
>> at
>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
>> at
>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
>> at
>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
>> at
>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>> at
>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
>> at
>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>>
>>
>>
>> Our views are very complicated so i can't find what is wrong.
>>
>> Can this be bug in myfaces? or it is problem in ours views?
>>
>>
>>
>> web.xml
>>
>>
>>
>> <context-param>
>>
>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>> <context-param>
>>
>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>> <context-param>
>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>>
>> thanks
>>
>>
>>
>> wojtek
>>
>>
>>
>
>
Re: Problem with myfaces 2.1.7-SNAPSHOT (ClassCastException during
RV(1) )
Posted by Werner Punz <we...@gmail.com>.
Best bet is to file a bugreport to get this fixed asap.
Werner
Am 19.03.12 22:14, schrieb Wojtek K:
> Hello!
>
>
>
> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we have problems with ui:repeat).
>
>
>
> With 2.1.7-SNAPSHOT sometimes we see this stacktrace:
>
>
>
> Caused by: java.lang.ClassCastException: org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to javax.faces.event.ComponentSystemEventListener
> at javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600)
> at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254)
> at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878)
> at javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181)
> at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021)
> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209)
> at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593)
> at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441)
> at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227)
> at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
> at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238)
> at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136)
>
>
>
> Our views are very complicated so i can't find what is wrong.
>
> Can this be bug in myfaces? or it is problem in ours views?
>
>
>
> web.xml
>
>
>
> <context-param>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
> <param-value>true</param-value>
> </context-param>
>
>
> thanks
>
>
>
> wojtek
>
>
>