[Orchestra] javax.faces.application.ViewExpiredException after session timeout

View: New views
6 Messages — Rating Filter:   Alert me  

[Orchestra] javax.faces.application.ViewExpiredException after session timeout

by alsha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using MyFaces+RichFaces+Orchestra

When I update from Orchestra 1.0 to 1.1, I am getting

javax.faces.application.ViewExpiredException: /pages/dms/dms_overview.jsfThe expected view was not returned for the view identifier: /pages/dms/dms_overview.jsf

after session timeout.

I do the following:

After login comes the home page. From this page I call the “/pages/dms/dms_overview.jsf” using <h:outputLink>. Then I wait a while, until session timeout is reached. Then I click somewhere on the page -> login mask comes. I log in again and click the same <h:outputLink> -> javax.faces.application.ViewExpiredException comes. After reloading the page it works again.

The same behaviour is observed, if I use <h:commandLink> and define a corresponding navigation-rule with <redirect/> in faces-config. Without <redirect/> it works fine.


With Orchestra 1.0 I had no problem.

Any ideas? Thanks for any help!

Regards,
Alexey

Re: [Orchestra] javax.faces.application.ViewExpiredException after session timeout

by Mario Ivankovits :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
> I am using MyFaces+RichFaces+Orchestra
>
> When I update from Orchestra 1.0 to 1.1, I am getting
>
> javax.faces.application.ViewExpiredException: /pages/dms/dms_overview.jsfThe
> expected view was not returned for the view identifier:
> /pages/dms/dms_overview.jsf
>  
I guess you are using MyFaces 1.2.x or JSF 1.2.x.

This is the "normal" problem you'll experience when the session times
out. I don't see how Orchestra 1.0 did help to solve that problem.
Probably you changed the JSF version lately? If I remember correctly
previous JSF versions just re-rendered the page.

Anyway, if possible use the a4j poller which helps keeping the session
alive as long as the user is on the page. This allows you to use a very
short session timeout, but keeping it alive as long as the user did not
close the browser or left your web application at all.

Something like this will do the trick:

    <a4j:region renderRegionOnly="true">
        <h:form id="_pingForm">
            <a4j:poll id="ajaxPoller"
                      interval="10000"
                      reRender="ajaxPollerResult,ajaxPollerCounter"
                      action="#{ping.pollAction}"
                      timeout="10000"/>
        </h:form>
    </a4j:region>

And gives another piece of real rich-client feeling :-)


Ciao,
Mario


Re: [Orchestra] javax.faces.application.ViewExpiredException after session timeout

by alsha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mario,

thank you for your reply.

yes, I am using MyFaces 1.2.2 (and RF3.1.2)

I am absolutely sure, that it works with myfaces-orchestra-core-1.0.jar - I need only to replace the .jar to see the difference! Nothing else changes!

Unfortuantly, we can not allow the user to stay online all the time. Each opened session consumes memory (we have many statefull beans with session life time).

Can you explain pls, why It works, if I use navigation with <navigation-case> without <redirect /> and does not work wit <redirect />?

Is there any workaround to generally avoid this exception or to handle it correctly?


Thanks in advance!

Best regards,
Alexey


Mario Ivankovits wrote:
Hi!
> I am using MyFaces+RichFaces+Orchestra
>
> When I update from Orchestra 1.0 to 1.1, I am getting
>
> javax.faces.application.ViewExpiredException: /pages/dms/dms_overview.jsfThe
> expected view was not returned for the view identifier:
> /pages/dms/dms_overview.jsf
>  
I guess you are using MyFaces 1.2.x or JSF 1.2.x.

This is the "normal" problem you'll experience when the session times
out. I don't see how Orchestra 1.0 did help to solve that problem.
Probably you changed the JSF version lately? If I remember correctly
previous JSF versions just re-rendered the page.

Anyway, if possible use the a4j poller which helps keeping the session
alive as long as the user is on the page. This allows you to use a very
short session timeout, but keeping it alive as long as the user did not
close the browser or left your web application at all.

Something like this will do the trick:

    <a4j:region renderRegionOnly="true">
        <h:form id="_pingForm">
            <a4j:poll id="ajaxPoller"
                      interval="10000"
                      reRender="ajaxPollerResult,ajaxPollerCounter"
                      action="#{ping.pollAction}"
                      timeout="10000"/>
        </h:form>
    </a4j:region>

And gives another piece of real rich-client feeling :-)


Ciao,
Mario

Re: [Orchestra] javax.faces.application.ViewExpiredException after session timeout

by Mario Ivankovits :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
> I am absolutely sure, that it works with myfaces-orchestra-core-1.0.jar - I
> need only to replace the .jar to see the difference! Nothing else changes!
>  
Strange, I have no clue why Orchestra 1.0 will avoid this problem.

> Unfortuantly, we can not allow the user to stay online all the time. Each
> opened session consumes memory (we have many statefull beans with session
> life time).
I understand, but notice: Using the poller keeps the session open only
as long as a browser is pointing to your application. On the other hand,
once the browser has been closed the session can die much faster.

If the session scoped beans are a problem think about putting them into
a separate (probably non-persistence-linked) conversation.manual scope.
If accessed every now and then it lives as long as the session.
Together with the poller then, the conversation.manual scope is able to
timeout and release memory, but the session is still alive with just a
handful of data in it.
I do it that way with our application.

> Can you explain pls, why It works, if I use navigation with
> <navigation-case> without <redirect /> and does not work wit <redirect />?
>  
No, I can't. Are you using client-side state saving? Probably without
<redirect /> JSF is able to restore itself to the point where it is
possible then to render again, though, it should not work either I think.
Do you have any chance to try the JSF RI Mojarra? Just wondering if it
makes any difference there too.

> Is there any workaround to generally avoid this exception or to handle it
> correctly?
>  
Probably you can configure an error handler for this exception in your
web.xml (I think it is called error-type where you can configure an
error page per exception) and explain the user that the session has expired.

Ciao,
Mario


Re: [Orchestra] javax.faces.application.ViewExpiredException after session timeout

by Hasan Turksoy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Though i don't see how orchestra is related to your session's timeout mechanism, this entry may help you build a session timeout handling infrastructure...

Regards,

Hasan...
www.jroller.com/hasant


On Wed, Jul 16, 2008 at 1:41 PM, Mario Ivankovits <mario@...> wrote:
Hi!

I am absolutely sure, that it works with myfaces-orchestra-core-1.0.jar - I
need only to replace the .jar to see the difference! Nothing else changes!
 
Strange, I have no clue why Orchestra 1.0 will avoid this problem.


Unfortuantly, we can not allow the user to stay online all the time. Each
opened session consumes memory (we have many statefull beans with session
life time).
I understand, but notice: Using the poller keeps the session open only as long as a browser is pointing to your application. On the other hand, once the browser has been closed the session can die much faster.

If the session scoped beans are a problem think about putting them into a separate (probably non-persistence-linked) conversation.manual scope. If accessed every now and then it lives as long as the session.
Together with the poller then, the conversation.manual scope is able to timeout and release memory, but the session is still alive with just a handful of data in it.
I do it that way with our application.


Can you explain pls, why It works, if I use navigation with
<navigation-case> without <redirect /> and does not work wit <redirect />?
 
No, I can't. Are you using client-side state saving? Probably without <redirect /> JSF is able to restore itself to the point where it is possible then to render again, though, it should not work either I think.
Do you have any chance to try the JSF RI Mojarra? Just wondering if it makes any difference there too.


Is there any workaround to generally avoid this exception or to handle it
correctly?
 
Probably you can configure an error handler for this exception in your web.xml (I think it is called error-type where you can configure an error page per exception) and explain the user that the session has expired.

Ciao,
Mario



Re: [Orchestra] javax.faces.application.ViewExpiredException after session timeout

by simon.kitching@chello.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Wed, 2008-07-16 at 11:06 +0200, Mario Ivankovits wrote:

> Hi!
> > I am using MyFaces+RichFaces+Orchestra
> >
> > When I update from Orchestra 1.0 to 1.1, I am getting
> >
> > javax.faces.application.ViewExpiredException: /pages/dms/dms_overview.jsfThe
> > expected view was not returned for the view identifier:
> > /pages/dms/dms_overview.jsf
> >  
> I guess you are using MyFaces 1.2.x or JSF 1.2.x.
>
> This is the "normal" problem you'll experience when the session times
> out. I don't see how Orchestra 1.0 did help to solve that problem.


One other cause of this "ViewExpiredException" message is when there is
a failure to serialize the view tree on the previous request. In this
case, an error message gets written to the logs but the page gets
rendered correctly (because serialization of the view occurs *after*
rendering is complete).

Then when a postback occurs, the view tree cannot be restored because it
was never saved in the first place. And whever there is no view tree to
be restored, it always reports "View Expired".

So please check your logs carefully for a message like "Exception while
serializing view state...." or something similar. It may be that the
newer version of orchestra causes slightly different view serialization
behaviour to occur.

If you can't find anything then please enable debug-level logging and
then attach them to an email.

Regards, Simon

LightInTheBox - Buy quality products at wholesale price