【问题标题】:How to inject FacesContext with JSF 2.3 and TomEE?如何使用 JSF 2.3 和 TomEE 注入 FacesContext?
【发布时间】:2018-02-01 10:46:57
【问题描述】:

我一直在尝试将 JSF 2.3 与 TomEE 服务器一起使用,但在使用 @Inject 注释和 FacesContext 对象时遇到问题。

当我使用它时,我在启动我的 TomEE 服务器时遇到以下异常:

SEVERE: CDI Beans module deployment failed 
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [javax.faces.context.FacesContext] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]

我错过了什么吗? 谢谢。

【问题讨论】:

    标签: jsf apache-tomee facescontext openwebbeans


    【解决方案1】:

    似乎某些 JSF2.3 功能必须通过设置使用的 JSF 版本来激活。

    尝试通过添加这个空类来设置 JSF 版本:

        import javax.faces.annotation.FacesConfig;
    
    /**
     * The presence of the @FacesConfig annotation on a managed bean deployed within an application enables version specific
     * features. In this case, it enables JSF CDI injection and EL resolution using CDI.
     *
     */
    @FacesConfig(version = FacesConfig.Version.JSF_2_3)
    public class ConfigurationBean {
    }
    

    来自https://github.com/javaee/glassfish/issues/22094

    【讨论】:

      猜你喜欢
      • 2019-04-09
      • 2017-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-13
      • 2011-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多