使用 JSF 升级 JBoss 7.2 - 范围类型 javax.enterprise.context.SessionScoped

问题描述

我正在尝试将我们的 Jboss EAP 从版本 6.4.21 升级到 7.2。

我们使用 JSF 和 myfaces 实现 – 版本 2.3.7

Jboss 服务器成功启动,但当我尝试浏览应用程序时,出现以下异常:

2020-12-02 09:36:53,903 ERROR (default task-3) [undertow.request] UT005023: Exception handling request to /archcommon/login.faces: org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped
        at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:647)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89)
        at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:164)
        at org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63)
        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:87)
        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:131)
        at org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy.generateUniqueViewScopeId(UnkNown Source)
        at org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.generateViewScopeId(CDIManagedBeanHandlerImpl.java:92)
        at org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(ViewScopeProxyMap.java:79)
        at org.apache.myfaces.view.ViewScopeProxyMap.isEmpty(ViewScopeProxyMap.java:104)
        at org.apache.myfaces.renderkit.ErrorPageWriter._writeVariables(ErrorPageWriter.java:792)
        at org.apache.myfaces.renderkit.ErrorPageWriter._writeVariables(ErrorPageWriter.java:770)
        at org.apache.myfaces.renderkit.ErrorPageWriter.debugHtml(ErrorPageWriter.java:357)
        at org.apache.myfaces.renderkit.ErrorPageWriter.handle(ErrorPageWriter.java:471)
        at org.apache.myfaces.context.MyFacesExceptionHandlerWrapperImpl.handle(MyFacesExceptionHandlerWrapperImpl.java:301)
        at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:61)

没有找到“没有作用域类型 javax.enterprise.context.SessionScoped 的活动上下文”的根本原因

有什么办法可以注入这个范围吗?使其设置并可用?

查看类 ViewScopeBeanHolder,我可以看到它用所需的 SessionScoped 进行了注释。 然而,当 Jbossweld 尝试从它持有的上下文映射中获取它时,使用 scopeType = SessionScoped,它失败了,因为它没有持有这种类型的活动上下文。 这是它所拥有的(来自调试):

org.jboss.weld.contexts.bound.BoundSessionContextImpl@6ecf7900
org.jboss.weld.module.web.context.http.HttpSessionContextImpl@2cdba234
org.jboss.weld.module.web.context.http.HttpSessionDestructionContext@1ff70377

这些是有关 ViewScopeBeanHolder 的相关日志记录(降低日志级别时):

在 jboss 启动时:

TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public org.apache.myfaces.cdi.view.ViewScopeBeanHolder()) defined,using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public org.apache.myfaces.cdi.view.ViewScopeBeanHolder()) defined,using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000004: Exactly one post construct method ([EnhancedAnnotatedMethodImpl] @postconstruct public org.apache.myfaces.cdi.view.ViewScopeBeanHolder.init()) for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000004: Exactly one post construct method ([EnhancedAnnotatedMethodImpl] @postconstruct public org.apache.myfaces.cdi.view.ViewScopeBeanHolder.init()) for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000006: Exactly one pre destroy method ([EnhancedAnnotatedMethodImpl] @PreDestroy public org.apache.myfaces.cdi.view.ViewScopeBeanHolder.destroyBeansOnPreDestroy()) for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000006: Exactly one pre destroy method ([EnhancedAnnotatedMethodImpl] @PreDestroy public org.apache.myfaces.cdi.view.ViewScopeBeanHolder.destroyBeansOnPreDestroy()) for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-001536: Found [] constructors annotated with @Inject for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 6) [weld.Bean] WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public org.apache.myfaces.cdi.view.ViewScopeBeanHolder()) defined,using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @SessionScoped class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 3) [weld.Bean] WELD-000012: Building bean Metadata for class org.apache.myfaces.cdi.view.ViewScopeBeanHolder
TRACE (Weld Thread Pool -- 3) [weld.Bean] WELD-000010: Using qualifiers [@javax.enterprise.inject.Any(),@javax.enterprise.inject.Default()] for Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]
TRACE (Weld Thread Pool -- 3) [weld.Bean] WELD-000014: Using name null for Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]
TRACE (Weld Thread Pool -- 3) [weld.Bean] WELD-000016: Using scope interface javax.enterprise.context.SessionScoped for Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]
DEBUG (MSC service thread 1-2) [weld.Bootstrap] WELD-000106: Bean: Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]
                                0: WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0

浏览用户界面时:

TRACE (default task-2) [weld.Bean] WELD-001538: Created context instance for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default] identified as WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0
TRACE (default task-2) [weld.Bean] WELD-001538: Created context instance for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default] identified as WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0
TRACE (default task-2) [weld.Bean] WELD-001542: Retrieving/generating proxy class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public void org.apache.myfaces.cdi.view.ViewScopeBeanHolder.init()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public org.apache.myfaces.cdi.view.ViewScopeContextualStorage org.apache.myfaces.cdi.view.ViewScopeBeanHolder.getContextualStorage(javax.enterprise.inject.spi.BeanManager,java.lang.String)
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public java.lang.String org.apache.myfaces.cdi.view.ViewScopeBeanHolder.generateUniqueViewScopeId()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public void org.apache.myfaces.cdi.view.ViewScopeBeanHolder.destroyBeansOnPreDestroy()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public java.util.Map org.apache.myfaces.cdi.view.ViewScopeBeanHolder.forceNewStorage()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public java.util.Map org.apache.myfaces.cdi.view.ViewScopeBeanHolder.getStorageMap()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public void org.apache.myfaces.cdi.view.ViewScopeBeanHolder.destroyBeans()
TRACE (default task-2) [weld.Bean] WELD-001541: Adding method to proxy: public void org.apache.myfaces.cdi.view.ViewScopeBeanHolder.destroyBeans(java.lang.String)
TRACE (default task-2) [weld.Bean] WELD-001543: Created Proxy class of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy supporting interfaces [interface java.io.Serializable,interface org.jboss.weld.proxy.WeldConstruct,interface org.jboss.weld.interceptor.util.proxy.TargetInstanceProxy,interface org.jboss.weld.proxy.WeldClientProxy,interface org.jboss.weld.interceptor.proxy.LifecycleMixin,interface org.jboss.weld.bean.proxy.ProxyObject]
TRACE (default task-2) [weld.Bean] WELD-001506: Created new client proxy of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default] with ID WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0
TRACE (default task-2) [weld.Bean] WELD-001506: Created new client proxy of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default] with ID WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0
TRACE (default task-2) [weld.Bean] WELD-001506: Created new client proxy of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default] with ID WELD%ManagedBean%DeutscheBankEar.ear|deployment.DeutscheBankEar.ear.additionalClasses|org.apache.myfaces.cdi.view.ViewScopeBeanHolder||0
TRACE (default task-2) [weld.Bean] WELD-001507: Located client proxy of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]
TRACE (default task-2) [weld.Bean] WELD-001507: Located client proxy of type class org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy for bean Managed Bean [class org.apache.myfaces.cdi.view.ViewScopeBeanHolder] with qualifiers [@Any @Default]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...