15:11:14,676 WARN FacesRequestAttributes:121 – Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@1059fd6] for attribute ‘purchaseController’ because FacesRequestAttributes does not support such callbacks
这个警告消息在我的日志中出现很多.对于每个受管Bean,只要它到期.在给定的时间过后,因为我使用MyFaces乐团.
我已经在我的web.xml中定义了org.springframework.web.context.request.RequestContextListener,而且我的classpath中没有spring jar(即不是类加载问题)
FacesRequestAttribute的文档说:
NOTE: In contrast to ServletRequestAttributes,this variant does not support destruction callbacks for scoped attributes,neither for the request scope nor for the session scope. If you rely on such implicit destruction callbacks,consider defining a Spring RequestContextListener in your web.xml.
purchaseController实际上是一个简单的托管bean(不扩展任何只实现Serializable的),用@Controller注释.
UPDATE1:
@Scope(“request”)和@Scope(“session”)中的bean似乎受到影响.
所以我想知道这个警告是否对正确的流量构成任何危险.即如果真的需要这些回调.如果没有,我将跳过与lo4j配置的警告.
更新2:
我进一步挖了一下,似乎这只是有时候发生.如果使用监听器,则RequestContextHolder.currentRequestAttributes()返回ServletRequestAttributes,而不是FacesRequestAttributes.所以看来有时监听器不起作用,并且不会在RequestContextHolder中设置当前的属性.
更新3:
我为RequestContextListener打开了调试,这里是结果:
07:21:31,518 DEBUG RequestContextListener:69 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@1190ae9
07:21:31,518 DEBUG RequestContextListener:89 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1190ae9
07:21:31,538 WARN FacesRequestAttributes:121 - Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@11aa152] for attribute 'org.apache.myfaces.orchestra.conversation.AccessScopeManager' because FacesRequestAttributes does not support such callbacks
07:21:31,541 WARN FacesRequestAttributes:121 - Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@1552393] for attribute 'localeController' because FacesRequestAttributes does not support such callbacks
....and so on,other request and session beans
在尝试访问bean之前,请求被破坏.这很奇怪这可能是由于servlet容器实现侦听器处理的一个问题吗?