2

I am using Primefaces Poll to make continuous ajax calls like this.

polll.xhtml :

<h:form>
    <h:outputText id="txt_count" value="#{counterView.number}" />
    <p:poll interval="3" listener="#{counterView.increment}" update="txt_count" />
</h:form>

Java :

@ManagedBean
@ViewScoped
public class CounterView implements Serializable {

    private int number;

    public int getNumber() {
        return number;
    }

    public void increment() {
        number++;
    }
}

server log :

14:09:24,918 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-39) javax.faces.application.ViewExpiredException: viewId:/polll.xhtml - View /polll.xhtml could not be restored.
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:212)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
    at com.aafes.com.primefacetest.ValidateSession.doFilter(ValidateSession.java:32)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

I don't understand why it is continuously throwing this exception even though in web.xml session time out is set to 30 min. I am using WildFly10 server. Can anyone help ?

Gans
  • 129
  • 2
  • 11
  • Does it also happen in an incognito browser window? (or when you manually trash all domain-related cache/cookies). – BalusC Apr 05 '16 at 19:20
  • Hey BalusC, I know you gonna reply me. I follow your posts a lot. By the way, yes it's happening in incognito browser too. And also I tried by removing all cache and cookies but no use. – Gans Apr 05 '16 at 19:26
  • Okay, next step: are you absolutely sure you aren't nesting this in another ``? – BalusC Apr 05 '16 at 19:28
  • No. Absolutely I am not nesting. For testing purpose I created a new project and just added one xhtml file with one java class. That's it. – Gans Apr 05 '16 at 19:32
  • Okay, next step: is the same HTTP session maintained across requests? (check JSESSIONID cookie in HTTP payload) – BalusC Apr 05 '16 at 19:36
  • Yes, I just looked for JsessionID. It's same for all requests. This problem seems very weird. – Gans Apr 05 '16 at 20:06
  • Okay, next step: do you have any JSF libraries in webapp's `/WEB-INF/lib`? – BalusC Apr 06 '16 at 07:04
  • Nope. It's a maven project with Netbeans. So I didn't include any libraries. I added dependency for primefaces in pom.xml and Using JSF 2.2 coming with Netbeans. – Gans Apr 06 '16 at 13:54

0 Answers0