升级到jsf2后出现ViewExpiredException [英] ViewExpiredException after upgrade to jsf2

查看:113
本文介绍了升级到jsf2后出现ViewExpiredException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近将主要平台从jsf 1.2升级到了2.0.升级后,我们每小时都会收到几个ViewExpiredException错误.通过阅读有关该主题的内容,看来会话终止时这是一个预期的例外,但是我们已经查看了访问日志,即使在某些情况下请求相隔仅5分钟,我们仍会收到这些例外.

我的问题如下:

1)除会话到期外,还有哪些其他情况可能导致ViewExpiredException?

2)我们正在记录的异常未包含导致异常的确切条件的详细信息(丢失会话,损坏的会话,无法还原特定组件).有没有一种方法可以引入其他日志记录来找出在每种情况下都会触发此异常的非常特殊的情况?

Mojarra 2.0.4-b09 雄猫6 使用Memcached会话管理器进行会话复制

感谢您的帮助.谢谢!

解决方案

除了会话过期外,还有哪些其他情况可能导致ViewExpiredException?

最终用户在会话中请求/创建了太多视图,并且正在提交旧视图.默认情况下,每个会话的最大观看次数上限为15.换句话说,如果最终用户在同一会话内具有表单的页面上打开16个浏览器窗口/选项卡并提交给第一个,则用户可以获取ViewExpiredException.

每个会话的最大观看次数可以在web.xml中通过

配置

<context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>15</param-value>
</context-param>

另请参阅 Mojarra FAQ . /p>


是否有办法引入额外的日志记录,以找出在每种情况下触发此异常的非常特殊的情况?

不是通过JSF和/或ViewExpiredException.整个异常仅表示该视图不再存在于会话中.这反过来可能确实有更多的潜在原因.使用 HttpSessionListener <记录会话的创建和销毁/a>并通过 可能会有所帮助.


更新,根据评论,在包含表单的缓存页面上按浏览器后退按钮,然后再提交表单,这实际上在视图过期时也可能导致ViewExpiredException.可以通过以下两种方法来解决此问题,最好是将它们结合使用:

  • 指示浏览器缓存页面.
  • 不要不要使用POST表单进行纯页到页的导航.

有关更多详细信息,请参见此答案.

We recently upgraded a major platform from jsf 1.2 to 2.0. After upgrading we're getting several ViewExpiredException errors each hour. From reading up on the topic it seems that this is an expected exception when sessions expire, however we've reviewed the access logs and we are getting these exceptions even when requests are only 5 minutes apart in some cases.

My questions are as follows:

1) Other than session expiration, what other conditions might cause ViewExpiredException?

2) The exception we're logging doesn't contain much detail about the exact condition that is causing the exception (missing session, corrupt session, unable to restore a particular component). Is there a way to introduce additional logging to find out the very specific situation that is triggering this exception in each case?

Mojarra 2.0.4-b09 Tomcat 6 Using Memcached Session Manager for session replication

Any help is appreciated. Thanks!

解决方案

Other than session expiration, what other conditions might cause ViewExpiredException?

The enduser has requested/created too much views within a session and is submitting to an old view. The default max views per session is 15. In other words, if the enduser opens 16 browser windows/tabs on a page with a form within the same session and submits to the first one, then the user can get ViewExpiredException.

The max views per session is configureable in web.xml by

<context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>15</param-value>
</context-param>

See also Mojarra FAQ for other parameters.


Is there a way to introduce additional logging to find out the very specific situation that is triggering this exception in each case?

Not through JSF and/or a ViewExpiredException. The whole exception just means that the view is not present in the session anymore. This can in turn indeed have more underlying causes. Logging the session creation and destroy using a HttpSessionListener and logging the session attribute modifications by HttpSessionAttributeListener may be helpful.


Update as per the comments, pressing the browser back button on a cached page containing a form and then submitting the form thereafter could indeed also cause ViewExpiredException when the view is been expired. This can be solved in following two ways, preferably in a combination of them:

  • Instruct the browser to not cache the pages.
  • Do not use POST forms for plain page-to-page navigation.

For more detail, see this answer.

这篇关于升级到jsf2后出现ViewExpiredException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆