小编Mig*_*ira的帖子

WELD-001303:Websphere 上范围类型 javax.enterprise.context.SessionScoped 没有活动上下文

我们已升级我们的应用程序以使用 CDI bean。当我们在 Wildfly 10.x 上部署应用程序时,这种更改非常顺利,但是当我们尝试在 Websphere Classic 和 Liberty 上部署相同的应用程序时,出现了一些问题。

我们查找了这里已经发布的几个问题,例如this、this、this或this,但没有一个答案能够解决我们的问题。

在我的本地主机上,我使用带有 webProfile-7.0 的 Websphere Liberty Profile,即 CDI-1.2、EL-3.0、JSF-2.2 和 servlet-3.1。我们的应用程序还使用 Primefaces 6.0。

问题发生在 PhaseListener 上。在其上,我们注入一个带有@Named(javax.inject.Named) 和@SessionScoped(javax.enterprise.context.SessionScoped) 注释的 Bean。

当在 PhaseListener 上调用注入的变量时,会引发以下错误。

[err] 2017-05-10 09:45:06 ERROR MWExceptionHandler:139 - A server exception occurred
org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:691)
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:83)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
at web.frmwrk.mgbean.WebSession$Proxy$_$$_WeldClientProxy.getLocale(Unknown Source)
at web.frmwrk.application.LocaleFaceletViewHandler.calculateLocale(LocaleFaceletViewHandler.java:43) …
Run Code Online (Sandbox Code Playgroud)

websphere primefaces cdi phaselistener jsf-2.2

4
推荐指数
1
解决办法
5358
查看次数

标签 统计

cdi ×1

jsf-2.2 ×1

phaselistener ×1

primefaces ×1

websphere ×1