Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

java - JBoss 7.2 upgrade with JSF - No active contexts for scope type javax.enterprise.context.SessionScoped

I am trying to upgrade our Jboss EAP from version 6.4.21 to 7.2.

We are using JSF with myfaces implementation – version 2.3.7

The Jboss server starts successfully but as I try to browse to the application, I am getting the following exception:

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)

Didn’t find the root cause for the “No active contexts for scope type javax.enterprise.context.SessionScoped”

Any way I can inject this scope? Make it setup and available?

looking into class ViewScopeBeanHolder, I can see it is annotated with the required SessionScoped. However, when Jboss weld tries to get it from the context map it holds, using scopeType = SessionScoped, it fails as it holds no active contexts of this type. This is what it holds (from debug):

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

These are the related loggings, regarding the ViewScopeBeanHolder (when lowering the log level):

On jboss startup:

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 -- 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

When browsing the UI:

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]
question from:https://stackoverflow.com/questions/65920370/jboss-7-2-upgrade-with-jsf-no-active-contexts-for-scope-type-javax-enterprise

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...