You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jarosław Szczepankiewicz <ja...@poczta.onet.pl> on 2012/08/09 14:11:08 UTC
ViewExpiredException with valid session
Hi,
I have a big (for me) problem with primefaces / myfaces.
Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
I have simple managed bean with @ViewScope. I have an edit form. I access the form with GET parameter:
/be/cms/article.faces?id=3
which is used to load the Article from DB. Form shows ok and is in session (i observer session id and it does not change). Then I click submit button. I get:
-----------------
[java] DEBUG [SessionTimeoutPhaseListener.java] beforePhase: RESTORE_VIEW(1)
[java] DEBUG [SessionTimeoutPhaseListener.java] NO session timeout detected...
[java] DEBUG [SessionTimeoutPhaseListener.java] afterPhase: RESTORE_VIEW(1)
javax.faces.application.ViewExpiredException: /be/cms/article.facesNo saved view state could be found for the view identifier: /be/cms/article.faces
[java] at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128) ~[myfaces-impl-2.1.2.jar:2.1.2]
[java] at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171) [myfaces-impl-2.1.2.jar:2.1.2]
[java] at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [myfaces-impl-2.1.2.jar:2.1.2]
[java] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) [myfaces-api-2.1.2.jar:2.1.2]
[java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [catalina.jar:7.0.26]
[java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.26]
[java] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) [catalina.jar:7.0.26]
[java] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) [catalina.jar:7.0.26]
[java] at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44) [tomee-catalina-4.0.0-beta-2.jar:4.0.0-beta-2]
[java] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.26]
[java] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) [catalina.jar:7.0.26]
[java] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.26]
[java] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) [catalina.jar:7.0.26]
[java] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.26]
[java] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.26]
[java] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) [tomcat-coyote.jar:7.0.26]
[java] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) [tomcat-coyote.jar:7.0.26]
[java] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) [tomcat-coyote.jar:7.0.26]
[java] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_03]
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_03]
[java] at java.lang.Thread.run(Unknown Source) [na:1.7.0_03]
-------------------
SessionTimeoutPhaseListener is my class that implements PhaseListener, strange thing is that phase listener shows that the exception is probably after RESTORE_VIEW :(.
The session is not timed out. I have org.apache.myfaces.VALIDATE = true.
ID of the session does not change. I have observed the PostConstruct entrance but no PreDestroy on my bean so probably my bean still lives and is ready to be bound to the view, but can not force the view to be restored.
I have used the following options:
1. facelets.BUILD_BEFORE_RESTORE = TRUE, does not matter
2. javax.faces.STATE_SAVING_METHOD = client or server, does not matter
3. changing AJAX to FALSE and using direct access does not matter
The post does
I have lost almost all my hairs. I will appreciate any help & advice. , thanks in advance
Sources:
article.xhtml
------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<f:metadata>
<f:viewParam name="id" value="#{articleEditBean.entryId}" required="true"
requiredMessage="No entry specified.">
<f:validateLongRange minimum="1" />
</f:viewParam>
<f:event type="preRenderView" listener="#{articleEditBean.loadEntry}" />
</f:metadata>
<h:head>
<title>Artykul edycja</title>
</h:head>
<body>
<ui:decorate template="/templates/masterDecorator.xhtml">
<p:panel header="Edytuj artykul">
<h:panelGrid columns="2" cellpadding="5">
<p:outputLabel for="articleName" value="Nazwa" />
<p:inputText id="articleName" value="#{articleEditBean.article.name}" required="true"/>
<p:outputLabel for="articleDescription" value="Opis" />
<p:inputTextarea id="articleDescription" rows="5" cols="120"
counter="counter" maxlength="4096"
value="#{articleEditBean.article.description}"
counterTemplate="{0} znakow pozostalo." autoResize="false" />
<h:outputText value="" />
<h:outputText id="counter" />
<p:outputLabel for="articleContent" value="Tresc" />
<p:editor id="articleContent" value="#{articleEditBean.article.content}"
width="600"/>
</h:panelGrid>
</p:panel>
<p>
<p:commandButton value="Save" id="ajax" ajax="false" actionListener="#{articleEditBean.listenSaveArticle}"
action="#{articleEditBean.saveArticle}" icon="ui-icon-disk" />
</p>
</ui:decorate>
</body>
</html>
------------------------------------------------------
ArticleEditBean.java
------------------------------------------------------
@ViewScoped
@ManagedBean
public class ArticleEditBean implements Serializable{
/**
*
*/
private static final long serialVersionUID = -679841341548988167L;
private Article article;
public Long getEntryId() {
logger.debug("getEntryId: {}", entryId);
return entryId;
}
public void setEntryId(Long entryId) {
logger.debug("setEntryId: {} ",entryId);
this.entryId = entryId;
}
public Article getArticle() {
logger.debug("getArticle(): {}", article);
return article;
}
private Long entryId;
@EJB
private ArticleService service;
private static Logger logger = LoggerFactory.getLogger(ArticleEditBean.class);
public void loadEntry() {
logger.debug("entering articleBean.loadEntry");
FacesContext ctx = FacesContext.getCurrentInstance();
if (ctx.isValidationFailed()) {
ctx.getApplication()
.getNavigationHandler()
.handleNavigation(ctx, "#{articleBean.loadEntry}",
"invalid");
return;
}
article = service.read(entryId);
if (article == null) {
ctx.getApplication()
.getNavigationHandler()
.handleNavigation(ctx, "#{articleBean.loadEntry}",
"invalid");
}
}
public void listenSaveArticle(ActionEvent e){
logger.debug("before listenSaveArticle... ");
FacesContext context = FacesContext.getCurrentInstance();
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
logger.debug("end of listenSaveArticle");
}
@PreDestroy
public void preDestroy(){
logger.debug("pre destroy");
}
@PostConstruct
public void init() {
logger.debug("in post construct");
}
public String saveArticle() {
logger.debug("entering articleEditBean.saveArticle()");
if (article.getId() != null) {
service.update(article);
} else {
service.create(article);
}
addMessage("Article " + article.getId() + " saved");
logger.debug("exiting articleEditBean.saveArticle()");
return "/be/welcome.xhtml?faces-redirect=true";
}
private void addMessage(String message) {
Flash flash = FacesContext.getCurrentInstance().getExternalContext()
.getFlash();
flash.setKeepMessages(true);
flash.setRedirect(true);
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(message));
}
public void setArticle(Article article) {
logger.debug("setArticle(): {}", article);
this.article = article;
}
------------------------------------------------------
Re: ViewExpiredException with valid session
Posted by Jarosław Szczepankiewicz <ja...@poczta.onet.pl>.
> Do you have multiple forms on your page?
I have one form (tried with two forms on page and it does not change anything) :(
Re: ViewExpiredException with valid session
Posted by Michael Heinen <mh...@googlemail.com>.
Do you have multiple forms on your page?
Am 09.08.2012 14:11, schrieb Jarosław Szczepankiewicz:
> Hi,
>
> I have a big (for me) problem with primefaces / myfaces.
> Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
>
> I have simple managed bean with @ViewScope. I have an edit form. I access the form with GET parameter:
> /be/cms/article.faces?id=3
>
> which is used to load the Article from DB. Form shows ok and is in session (i observer session id and it does not change). Then I click submit button. I get:
> -----------------
> [java] DEBUG [SessionTimeoutPhaseListener.java] beforePhase: RESTORE_VIEW(1)
> [java] DEBUG [SessionTimeoutPhaseListener.java] NO session timeout detected...
> [java] DEBUG [SessionTimeoutPhaseListener.java] afterPhase: RESTORE_VIEW(1)
> javax.faces.application.ViewExpiredException: /be/cms/article.facesNo saved view state could be found for the view identifier: /be/cms/article.faces
> [java] at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128) ~[myfaces-impl-2.1.2.jar:2.1.2]
> [java] at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171) [myfaces-impl-2.1.2.jar:2.1.2]
> [java] at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [myfaces-impl-2.1.2.jar:2.1.2]
> [java] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) [myfaces-api-2.1.2.jar:2.1.2]
> [java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) [catalina.jar:7.0.26]
> [java] at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44) [tomee-catalina-4.0.0-beta-2.jar:4.0.0-beta-2]
> [java] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.26]
> [java] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.26]
> [java] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) [tomcat-coyote.jar:7.0.26]
> [java] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) [tomcat-coyote.jar:7.0.26]
> [java] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) [tomcat-coyote.jar:7.0.26]
> [java] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_03]
> [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_03]
> [java] at java.lang.Thread.run(Unknown Source) [na:1.7.0_03]
> -------------------
> SessionTimeoutPhaseListener is my class that implements PhaseListener, strange thing is that phase listener shows that the exception is probably after RESTORE_VIEW :(.
>
> The session is not timed out. I have org.apache.myfaces.VALIDATE = true.
> ID of the session does not change. I have observed the PostConstruct entrance but no PreDestroy on my bean so probably my bean still lives and is ready to be bound to the view, but can not force the view to be restored.
> I have used the following options:
>
> 1. facelets.BUILD_BEFORE_RESTORE = TRUE, does not matter
> 2. javax.faces.STATE_SAVING_METHOD = client or server, does not matter
> 3. changing AJAX to FALSE and using direct access does not matter
>
> The post does
> I have lost almost all my hairs. I will appreciate any help & advice. , thanks in advance
>
> Sources:
> article.xhtml
> ------------------------------------------------------
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:p="http://primefaces.org/ui">
>
> <f:metadata>
> <f:viewParam name="id" value="#{articleEditBean.entryId}" required="true"
> requiredMessage="No entry specified.">
>
> <f:validateLongRange minimum="1" />
> </f:viewParam>
>
> <f:event type="preRenderView" listener="#{articleEditBean.loadEntry}" />
> </f:metadata>
>
> <h:head>
> <title>Artykul edycja</title>
> </h:head>
>
> <body>
> <ui:decorate template="/templates/masterDecorator.xhtml">
> <p:panel header="Edytuj artykul">
>
> <h:panelGrid columns="2" cellpadding="5">
>
> <p:outputLabel for="articleName" value="Nazwa" />
> <p:inputText id="articleName" value="#{articleEditBean.article.name}" required="true"/>
>
> <p:outputLabel for="articleDescription" value="Opis" />
> <p:inputTextarea id="articleDescription" rows="5" cols="120"
> counter="counter" maxlength="4096"
> value="#{articleEditBean.article.description}"
> counterTemplate="{0} znakow pozostalo." autoResize="false" />
>
> <h:outputText value="" />
> <h:outputText id="counter" />
> <p:outputLabel for="articleContent" value="Tresc" />
> <p:editor id="articleContent" value="#{articleEditBean.article.content}"
> width="600"/>
>
> </h:panelGrid>
> </p:panel>
> <p>
> <p:commandButton value="Save" id="ajax" ajax="false" actionListener="#{articleEditBean.listenSaveArticle}"
> action="#{articleEditBean.saveArticle}" icon="ui-icon-disk" />
> </p>
>
>
> </ui:decorate>
> </body>
> </html>
> ------------------------------------------------------
>
> ArticleEditBean.java
> ------------------------------------------------------
> @ViewScoped
> @ManagedBean
> public class ArticleEditBean implements Serializable{
>
> /**
> *
> */
> private static final long serialVersionUID = -679841341548988167L;
>
> private Article article;
> public Long getEntryId() {
> logger.debug("getEntryId: {}", entryId);
> return entryId;
> }
>
> public void setEntryId(Long entryId) {
> logger.debug("setEntryId: {} ",entryId);
> this.entryId = entryId;
> }
>
> public Article getArticle() {
> logger.debug("getArticle(): {}", article);
> return article;
> }
>
> private Long entryId;
>
> @EJB
> private ArticleService service;
>
> private static Logger logger = LoggerFactory.getLogger(ArticleEditBean.class);
>
> public void loadEntry() {
> logger.debug("entering articleBean.loadEntry");
> FacesContext ctx = FacesContext.getCurrentInstance();
> if (ctx.isValidationFailed()) {
> ctx.getApplication()
> .getNavigationHandler()
> .handleNavigation(ctx, "#{articleBean.loadEntry}",
> "invalid");
> return;
> }
>
> article = service.read(entryId);
>
> if (article == null) {
>
> ctx.getApplication()
> .getNavigationHandler()
> .handleNavigation(ctx, "#{articleBean.loadEntry}",
> "invalid");
> }
>
>
> }
>
> public void listenSaveArticle(ActionEvent e){
> logger.debug("before listenSaveArticle... ");
> FacesContext context = FacesContext.getCurrentInstance();
> Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
>
> logger.debug("end of listenSaveArticle");
>
> }
> @PreDestroy
> public void preDestroy(){
> logger.debug("pre destroy");
> }
>
> @PostConstruct
> public void init() {
> logger.debug("in post construct");
>
> }
>
> public String saveArticle() {
> logger.debug("entering articleEditBean.saveArticle()");
> if (article.getId() != null) {
> service.update(article);
> } else {
> service.create(article);
> }
>
> addMessage("Article " + article.getId() + " saved");
> logger.debug("exiting articleEditBean.saveArticle()");
> return "/be/welcome.xhtml?faces-redirect=true";
> }
>
> private void addMessage(String message) {
> Flash flash = FacesContext.getCurrentInstance().getExternalContext()
> .getFlash();
> flash.setKeepMessages(true);
> flash.setRedirect(true);
> FacesContext.getCurrentInstance().addMessage(null,
> new FacesMessage(message));
> }
>
> public void setArticle(Article article) {
> logger.debug("setArticle(): {}", article);
> this.article = article;
> }
> ------------------------------------------------------
>
>
Re: ViewExpiredException with valid session
Posted by Werner Punz <we...@gmail.com>.
Am 10.08.12 18:35, schrieb Werner Punz:
> Am 09.08.12 16:04, schrieb Jarosław Szczepankiewicz:
>>
>>
>>> Hmm... which versions of PrimeFaces and MyFaces are you using?
>>> ___
>>
>> Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
>>
>>
> 2.1.2 is already rathe old, can you update myfaces and check if the
> problem goes away.
>
>
>
The newest version is 2.1.8
Werner
Re: ViewExpiredException with valid session
Posted by Werner Punz <we...@gmail.com>.
Am 09.08.12 16:04, schrieb Jarosław Szczepankiewicz:
>
>
>> Hmm... which versions of PrimeFaces and MyFaces are you using?
>> ___
>
> Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
>
>
2.1.2 is already rathe old, can you update myfaces and check if the
problem goes away.
Re: ViewExpiredException with valid session
Posted by Jarosław Szczepankiewicz <ja...@poczta.onet.pl>.
> Hmm... which versions of PrimeFaces and MyFaces are you using?
> ___
Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
Re: ViewExpiredException with valid session
Posted by Kito Mann <ki...@virtua.com>.
Hmm... which versions of PrimeFaces and MyFaces are you using?
___
Kito D. Mann | @kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info |
@jsfcentral
+1 203-404-4848 x246
* Listen to the latest headlines in the JSF and Java EE newscast: *
http://blogs.jsfcentral.com/JSFNewscast/*
* Sign up for the JSFCentral Newsletter: http://oi.vresp.com/?fid=ac048d0e17
On Thu, Aug 9, 2012 at 9:02 AM, Jarosław Szczepankiewicz <
jarrman@poczta.onet.pl> wrote:
> Hi, thanks for interest. The scenario looks as following (with ajax =
> false on button):
>
> 1. deploying the application
> 2. accessing page with form (GET) -> shows the form with filled values for
> Article with ID = 3, no exception
> 3. clicking the button
> exception
>
>
> situation the same if i
> 1. deploying the application
> 2. accessing page with form (GET) -> shows the form with filled values for
> Article with ID = 3, no exception
> 3. refresh the browser (to be sure that the session exists before page
> enters)
> 3. clicking the button
> exception
>
> (...)
>
>
>
Re: ViewExpiredException with valid session
Posted by Jarosław Szczepankiewicz <ja...@poczta.onet.pl>.
Hi, thanks for interest. The scenario looks as following (with ajax = false on button):
1. deploying the application
2. accessing page with form (GET) -> shows the form with filled values for Article with ID = 3, no exception
3. clicking the button
exception
situation the same if i
1. deploying the application
2. accessing page with form (GET) -> shows the form with filled values for Article with ID = 3, no exception
3. refresh the browser (to be sure that the session exists before page enters)
3. clicking the button
exception
(...)
Re: ViewExpiredException with valid session
Posted by Kito Mann <ki...@virtua.com>.
Helo Jaroslaw,
Does this happen the _very_ first time you click on the button, even when
ajax is set to false for the button?
___
Kito D. Mann | @kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info |
@jsfcentral
+1 203-404-4848 x246
* Listen to the latest headlines in the JSF and Java EE newscast: *
http://blogs.jsfcentral.com/JSFNewscast/*
* Sign up for the JSFCentral Newsletter: http://oi.vresp.com/?fid=ac048d0e17
On Thu, Aug 9, 2012 at 8:11 AM, Jarosław Szczepankiewicz <
jarrman@poczta.onet.pl> wrote:
> Hi,
>
> I have a big (for me) problem with primefaces / myfaces.
> Server: tomcat 7, myfaces: 2.1.2, jdk 7, primefaces 3.3.1
>
> I have simple managed bean with @ViewScope. I have an edit form. I access
> the form with GET parameter:
> /be/cms/article.faces?id=3
>
> which is used to load the Article from DB. Form shows ok and is in session
> (i observer session id and it does not change). Then I click submit button.
> I get:
> -----------------
> [java] DEBUG [SessionTimeoutPhaseListener.java] beforePhase:
> RESTORE_VIEW(1)
> [java] DEBUG [SessionTimeoutPhaseListener.java] NO session timeout
> detected...
> [java] DEBUG [SessionTimeoutPhaseListener.java] afterPhase:
> RESTORE_VIEW(1)
> javax.faces.application.ViewExpiredException: /be/cms/article.facesNo
> saved view state could be found for the view identifier:
> /be/cms/article.faces
> [java] at
> org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
> ~[myfaces-impl-2.1.2.jar:2.1.2]
> [java] at
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
> [myfaces-impl-2.1.2.jar:2.1.2]
> [java] at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
> [myfaces-impl-2.1.2.jar:2.1.2]
> [java] at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
> [myfaces-api-2.1.2.jar:2.1.2]
> [java] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
> [tomee-catalina-4.0.0-beta-2.jar:4.0.0-beta-2]
> [java] at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> [catalina.jar:7.0.26]
> [java] at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
> [tomcat-coyote.jar:7.0.26]
> [java] at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
> [tomcat-coyote.jar:7.0.26]
> [java] at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
> [tomcat-coyote.jar:7.0.26]
> [java] at
> java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> [na:1.7.0_03]
> [java] at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> [na:1.7.0_03]
> [java] at java.lang.Thread.run(Unknown Source) [na:1.7.0_03]
> -------------------
> SessionTimeoutPhaseListener is my class that implements PhaseListener,
> strange thing is that phase listener shows that the exception is probably
> after RESTORE_VIEW :(.
>
> The session is not timed out. I have org.apache.myfaces.VALIDATE = true.
> ID of the session does not change. I have observed the PostConstruct
> entrance but no PreDestroy on my bean so probably my bean still lives and
> is ready to be bound to the view, but can not force the view to be restored.
> I have used the following options:
>
> 1. facelets.BUILD_BEFORE_RESTORE = TRUE, does not matter
> 2. javax.faces.STATE_SAVING_METHOD = client or server, does not matter
> 3. changing AJAX to FALSE and using direct access does not matter
>
> The post does
> I have lost almost all my hairs. I will appreciate any help & advice. ,
> thanks in advance
>
> Sources:
> article.xhtml
> ------------------------------------------------------
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:p="http://primefaces.org/ui">
>
> <f:metadata>
> <f:viewParam name="id" value="#{articleEditBean.entryId}"
> required="true"
> requiredMessage="No entry specified.">
>
> <f:validateLongRange minimum="1" />
> </f:viewParam>
>
> <f:event type="preRenderView"
> listener="#{articleEditBean.loadEntry}" />
> </f:metadata>
>
> <h:head>
> <title>Artykul edycja</title>
> </h:head>
>
> <body>
> <ui:decorate template="/templates/masterDecorator.xhtml">
> <p:panel header="Edytuj artykul">
>
> <h:panelGrid columns="2" cellpadding="5">
>
> <p:outputLabel for="articleName"
> value="Nazwa" />
> <p:inputText id="articleName" value="#{
> articleEditBean.article.name}" required="true"/>
>
> <p:outputLabel for="articleDescription"
> value="Opis" />
> <p:inputTextarea id="articleDescription"
> rows="5" cols="120"
> counter="counter" maxlength="4096"
>
> value="#{articleEditBean.article.description}"
> counterTemplate="{0} znakow
> pozostalo." autoResize="false" />
>
> <h:outputText value="" />
> <h:outputText id="counter" />
> <p:outputLabel for="articleContent"
> value="Tresc" />
> <p:editor id="articleContent"
> value="#{articleEditBean.article.content}"
> width="600"/>
>
> </h:panelGrid>
> </p:panel>
> <p>
> <p:commandButton value="Save" id="ajax"
> ajax="false" actionListener="#{articleEditBean.listenSaveArticle}"
> action="#{articleEditBean.saveArticle}"
> icon="ui-icon-disk" />
> </p>
>
>
> </ui:decorate>
> </body>
> </html>
> ------------------------------------------------------
>
> ArticleEditBean.java
> ------------------------------------------------------
> @ViewScoped
> @ManagedBean
> public class ArticleEditBean implements Serializable{
>
> /**
> *
> */
> private static final long serialVersionUID = -679841341548988167L;
>
> private Article article;
> public Long getEntryId() {
> logger.debug("getEntryId: {}", entryId);
> return entryId;
> }
>
> public void setEntryId(Long entryId) {
> logger.debug("setEntryId: {} ",entryId);
> this.entryId = entryId;
> }
>
> public Article getArticle() {
> logger.debug("getArticle(): {}", article);
> return article;
> }
>
> private Long entryId;
>
> @EJB
> private ArticleService service;
>
> private static Logger logger =
> LoggerFactory.getLogger(ArticleEditBean.class);
>
> public void loadEntry() {
> logger.debug("entering articleBean.loadEntry");
> FacesContext ctx = FacesContext.getCurrentInstance();
> if (ctx.isValidationFailed()) {
> ctx.getApplication()
> .getNavigationHandler()
> .handleNavigation(ctx,
> "#{articleBean.loadEntry}",
> "invalid");
> return;
> }
>
> article = service.read(entryId);
>
> if (article == null) {
>
> ctx.getApplication()
> .getNavigationHandler()
> .handleNavigation(ctx,
> "#{articleBean.loadEntry}",
> "invalid");
> }
>
>
> }
>
> public void listenSaveArticle(ActionEvent e){
> logger.debug("before listenSaveArticle... ");
> FacesContext context = FacesContext.getCurrentInstance();
> Map<String, String> requestParams =
> context.getExternalContext().getRequestParameterMap();
>
> logger.debug("end of listenSaveArticle");
>
> }
> @PreDestroy
> public void preDestroy(){
> logger.debug("pre destroy");
> }
>
> @PostConstruct
> public void init() {
> logger.debug("in post construct");
>
> }
>
> public String saveArticle() {
> logger.debug("entering articleEditBean.saveArticle()");
> if (article.getId() != null) {
> service.update(article);
> } else {
> service.create(article);
> }
>
> addMessage("Article " + article.getId() + " saved");
> logger.debug("exiting articleEditBean.saveArticle()");
> return "/be/welcome.xhtml?faces-redirect=true";
> }
>
> private void addMessage(String message) {
> Flash flash =
> FacesContext.getCurrentInstance().getExternalContext()
> .getFlash();
> flash.setKeepMessages(true);
> flash.setRedirect(true);
> FacesContext.getCurrentInstance().addMessage(null,
> new FacesMessage(message));
> }
>
> public void setArticle(Article article) {
> logger.debug("setArticle(): {}", article);
> this.article = article;
> }
> ------------------------------------------------------
>
>