omn​​ifaces在openwebbeans 1.5.0之前开始?

时间:2015-05-21 21:52:26

标签: tomcat omnifaces openwebbeans

我使用的是Java 8 / Tomcat 8 / OpenWebBeans 1.5.0 / MyFaces 2.2.8 / DeltaSpike 1.3.0。

由于我想使用openwebbeans-tomcat7模块,我将以下jar放在tomcat / lib中:

  • 的OpenWebBeans-web的1.5.0.jar
  • 的OpenWebBeans-tomcat7-1.5.0.jar
  • 的OpenWebBeans-SPI-1.5.0.jar
  • 的OpenWebBeans-资源1.5.0.jar
  • 的OpenWebBeans-JSF-1.5.0.jar
  • 的OpenWebBeans-IMPL-1.5.0.jar
  • 的OpenWebBeans-el22-1.5.0.jar
  • xbean取景器阴影-4.1.jar
  • xbean-ASM5阴影-4.1.jar
  • MyFaces的-IMPL-2.2.8.jar
  • MyFaces的-API-2.2.8.jar
  • 的geronimo-atinject_1.0_spec-1.0.jar
  • 的geronimo-annotation_1.2_spec-1.0.jar
  • 的geronimo-validation_1.0_spec-1.1.jar
  • 的geronimo-STAX-api_1.0_spec-1.0.jar
  • 的geronimo-servlet_3.0_spec-1.0.jar
  • 的geronimo-jcdi_1.1_spec-1.0.jar
  • 的geronimo-interceptor_1.2_spec-1.0.jar
  • 公地消化器-1.8.jar
  • 公地BeanUtils的-1.8.3.jar
  • 公地集合-3.2.jar
  • 共享记录-1.1.1.jar
  • 公地编解码器-1.3.jar

我也喜欢使用伟大的omnifaces库。所以,我的webapp在WEB-INF / lib

中有作为依赖项的omnifaces

CDI与我使用的两个版本1.8.1和2.0存在问题。 在我看来,omnifaces是在openwebbeans之前启动的,所以没有找到CDI。

使用1.8.1时,此问题会引发异常,但它是非阻塞的,因为此版本中CDI不是必需的。在2.0中,它可以防止webapp启动,因为omnifaces 2.0将CDI作为一项要求。

使用1.8.1,log为:

21-May-2015 23:07:17.678 INFO [main] org.apache.catalina.core.StandardService.startInternal Démarrage du service Catalina
21-May-2015 23:07:17.678 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.20
21-May-2015 23:07:17.690 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Déploiement du descripteur de configuration /opt/apache-tomcat-8.0.20/conf/Catalina/localhost/apps#presences#edit.xml
21-May-2015 23:07:18.914 INFO [localhost-startStop-1] org.apache.catalina.core.StandardContext.addApplicationListener The listener "org.apache.webbeans.servlet.WebBeansConfigurationListener" is already configured for this context. The duplicate definition has been ignored.
21-May-2015 23:07:19.199 SEVERE [localhost-startStop-1] org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject Error is occured while injecting the OpenWebBeans dependencies for instance org.omnifaces.cdi.eager.EagerBeansRequestListener@7dd5f8b3
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.BeansInstantiator] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  eagerBeansRepository, Bean Owner : [null]
    at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:65)
    at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:271)
    at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:82)
    at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
    at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
    at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:57)
    at org.apache.webbeans.web.tomcat7.TomcatUtil.inject(TomcatUtil.java:40)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject(TomcatInstanceManager.java:122)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:88)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

21-May-2015 23:07:19.201 SEVERE [localhost-startStop-1] org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject Error is occured while injecting the OpenWebBeans dependencies for instance org.omnifaces.cdi.eager.EagerBeansSessionListener@26cf68af
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.BeansInstantiator] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  eagerBeansRepository, Bean Owner : [null]
    at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:65)
    at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:271)
    at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:82)
    at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
    at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
    at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:57)
    at org.apache.webbeans.web.tomcat7.TomcatUtil.inject(TomcatUtil.java:40)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject(TomcatInstanceManager.java:122)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:88)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

21-May-2015 23:07:19.201 SEVERE [localhost-startStop-1] org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject Error is occured while injecting the OpenWebBeans dependencies for instance org.omnifaces.cdi.eager.EagerBeansSessionListener@26cf68af
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.BeansInstantiator] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  eagerBeansRepository, Bean Owner : [null]
    at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:65)
    at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:271)
    at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:82)
    at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
    at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
    at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
    at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:57)
    at org.apache.webbeans.web.tomcat7.TomcatUtil.inject(TomcatUtil.java:40)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject(TomcatInstanceManager.java:122)
    at org.apache.webbeans.web.tomcat7.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:88)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

21-May-2015 23:07:19.240 INFO [localhost-startStop-1] org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication OpenWebBeans Container is starting...
21-May-2015 23:07:19.242 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [TomcatWebPlugin]
21-May-2015 23:07:19.242 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
21-May-2015 23:07:19.246 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: file:/mnt/ssd/home_bis/dev/git/presences/presences_modules/editpresences/target/edit%23%231.0-SNAPSHOT/WEB-INF/classes/META-INF/beans.xml
21-May-2015 23:07:19.252 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/mnt/ssd/home_bis/dev/git/presences/presences_modules/editpresences/target/edit%23%231.0-SNAPSHOT/

使用2.0,它是:

21-May-2015 23:32:12.076 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.20
21-May-2015 23:32:12.090 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Déploiement du descripteur de configuration /opt/apache-tomcat-8.0.20/conf/Catalina/localhost/apps#presences#edit.xml
21-May-2015 23:32:13.389 INFO [localhost-startStop-1] org.apache.catalina.core.StandardContext.addApplicationListener The listener "org.apache.webbeans.servlet.WebBeansConfigurationListener" is already configured for this context. The duplicate definition has been ignore
d.
21-May-2015 23:32:13.641 INFO [localhost-startStop-1] org.omnifaces.ApplicationInitializer.logOmniFacesVersion Using OmniFaces version 2.0
21-May-2015 23:32:13.644 SEVERE [localhost-startStop-1] org.omnifaces.ApplicationInitializer.checkCDIAvailable 
████████████████████████████████████████████████████████████████████████████████
▌                         ▐█     ▐                                             ▐
▌    ▄                  ▄█▓█▌    ▐ OmniFaces failed to initialize!             ▐
▌   ▐██▄               ▄▓░░▓▓    ▐                                             ▐
▌   ▐█░██▓            ▓▓░░░▓▌    ▐ This OmniFaces version requires CDI, but    ▐
▌   ▐█▌░▓██          █▓░░░░▓     ▐ none was found on this environment.         ▐
▌    ▓█▌░░▓█▄███████▄███▓░▓█     ▐                                             ▐
▌    ▓██▌░▓██░░░░░░░░░░▓█░▓▌     ▐ OmniFaces 2.x requires a minimum of JSF 2.2.▐
▌     ▓█████░░░░░░░░░░░░▓██      ▐ Since this JSF version, the JSF managed bean▐
▌     ▓██▓░░░░░░░░░░░░░░░▓█      ▐ facility @ManagedBean is semi-official      ▐
▌     ▐█▓░░░░░░█▓░░▓█░░░░▓█▌     ▐ deprecated in favour of CDI. JSF 2.2 users  ▐
▌     ▓█▌░▓█▓▓██▓░█▓▓▓▓▓░▓█▌     ▐ are strongly encouraged to move to CDI.     ▐
▌     ▓▓░▓██████▓░▓███▓▓▌░█▓     ▐                                             ▐
▌    ▐▓▓░█▄▐▓▌█▓░░▓█▐▓▌▄▓░██     ▐ OmniFaces goes a step further by making CDI ▐
▌    ▓█▓░▓█▄▄▄█▓░░▓█▄▄▄█▓░██▌    ▐ a REQUIRED dependency next to JSF 2.2. This ▐
▌    ▓█▌░▓█████▓░░░▓███▓▀░▓█▓    ▐ not only ensures that your web application  ▐
▌   ▐▓█░░░▀▓██▀░░░░░ ▀▓▀░░▓█▓    ▐ represents the state of art, but this also  ▐
▌   ▓██░░░░░░░░▀▄▄▄▄▀░░░░░░▓▓    ▐ makes for us easier to develop OmniFaces,   ▐
▌   ▓█▌░░░░░░░░░░▐▌░░░░░░░░▓▓▌   ▐ without the need for all sorts of hacks in  ▐
▌   ▓█░░░░░░░░░▄▀▀▀▀▄░░░░░░░█▓   ▐ in order to get OmniFaces to deploy on      ▐
▌  ▐█▌░░░░░░░░▀░░░░░░▀░░░░░░█▓▌  ▐ environments without CDI.                   ▐
▌  ▓█░░░░░░░░░░░░░░░░░░░░░░░██▓  ▐                                             ▐
▌  ▓█░░░░░░░░░░░░░░░░░░░░░░░▓█▓  ▐ You have 3 options:                         ▐
██████████████████████████████████ 1. Downgrade to OmniFaces 1.x.              ▐
█░▀░░░░▀█▀░░░░░░▀█░░░░░░▀█▀░░░░░▀█ 2. Install CDI in this environment.         ▐
█░░▐█▌░░█░░░██░░░█░░██░░░█░░░██░░█ 3. Switch to a CDI capable environment.     ▐
█░░▐█▌░░█░░░██░░░█░░██░░░█░░░██░░█                                             ▐
█░░▐█▌░░█░░░██░░░█░░░░░░▄█░░▄▄▄▄▄█ For additional instructions, check          ▐
█░░▐█▌░░█░░░██░░░█░░░░████░░░░░░░█ http://omnifaces.org/cdi                    ▐
█░░░█░░░█▄░░░░░░▄█░░░░████▄░░░░░▄█                                             ▐
████████████████████████████████████████████████████████████████████████████████
21-May-2015 23:32:13.645 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    at org.omnifaces.ApplicationInitializer.checkCDIAvailable(ApplicationInitializer.java:101)
    at org.omnifaces.ApplicationInitializer.onStartup(ApplicationInitializer.java:50)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5151)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
    at org.omnifaces.ApplicationInitializer.checkCDIAvailable(ApplicationInitializer.java:64)
    ... 13 more
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in JNDI.
    at org.omnifaces.config.BeanManager.<init>(BeanManager.java:106)
    at org.omnifaces.config.BeanManager.<clinit>(BeanManager.java:49)
    ... 14 more

21-May-2015 23:32:13.651 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Erreur de démarrage du contexte [/apps/presences/edit] suite aux erreurs précédentes
21-May-2015 23:32:13.657 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor /opt/apache-tomcat-8.0.20/conf/Catalina/localhost/apps#presences#edit.xml has finished in 1 566 ms
21-May-2015 23:32:13.659 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Déploiement de l'archive /opt/apache-tomcat-8.0.20/webapps/edit##1.0-SNAPSHOT.war de l'application web
21-May-2015 23:32:14.649 INFO [localhost-startStop-1] org.apache.catalina.core.StandardContext.addApplicationListener The listener "org.apache.webbeans.servlet.WebBeansConfigurationListener" is already configured for this context. The duplicate definition has been ignored.
21-May-2015 23:32:14.767 INFO [localhost-startStop-1] org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication OpenWebBeans Container is starting...
21-May-2015 23:32:14.773 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: file:/opt/apache-tomcat-8.0.20/webapps/edit%23%231.0-SNAPSHOT/WEB-INF/classes/META-INF/beans.xml
21-May-2015 23:32:14.779 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.20/webapps/edit%23%231.0-SNAPSHOT/WEB-INF/lib/deltaspike-core-impl-1.3.0.jar!/ME

只有omnifaces才会出现问题。 OWB在我的webapp中工作。

启动序列仍然非常波动,具体取决于容器(例如,请参阅http://javaeesquad.blogspot.fr/2015/03/getting-notified-when-java-ee.html)。

我看到OmniFaces已经处理了Glassfish特例:

public class ApplicationInitializer实现ServletContainerInitializer {

    // Constants ------------------------------------------------------------------------------------------------------

    private static final Logger logger = Logger.getLogger(ApplicationInitializer.class.getName());

    // Actions --------------------------------------------------------------------------------------------------------

    @Override
    public void onStartup(Set<Class<?>> c, ServletContext servletContext) throws ServletException {
            logOmniFacesVersion();
            checkCDIAvailable(servletContext);
            FacesViews.registerFilter(servletContext);
    }

    private void logOmniFacesVersion() {
            logger.info("Using OmniFaces version " + getClass().getPackage().getSpecificationVersion());
    }

    private void checkCDIAvailable(ServletContext servletContext) throws ServletException {
            if (Hacks.isCDIAvailableInGlassFish(servletContext)) {
                    return; // Okay. Don't proceed, because GF4 fails to scan JNDI during servlet container initialization.
            }

            try {
                    BeanManager.INSTANCE.toString();
            }
            catch (Throwable e) {
                    logger.severe(""
                            + "\n████████████████████████████████████████████████████████████████████████████████"
                            + "\n▌                         ▐█     ▐                                             ▐"
                            + "\n▌    ▄                  ▄█▓█▌    ▐ OmniFaces failed to initialize!             ▐"
                            + "\n▌   ▐██▄               ▄▓░░▓▓    ▐                                             ▐"
                            + "\n▌   ▐█░██▓            ▓▓░░░▓▌    ▐ This OmniFaces version requires CDI, but    ▐"
                            + "\n▌   ▐█▌░▓██          █▓░░░░▓     ▐ none was found on this environment.         ▐"
                            + "\n▌    ▓█▌░░▓█▄███████▄███▓░▓█     ▐                                             ▐"
                            + "\n▌    ▓██▌░▓██░░░░░░░░░░▓█░▓▌     ▐ OmniFaces 2.x requires a minimum of JSF 2.2.▐"
                            + "\n▌     ▓█████░░░░░░░░░░░░▓██      ▐ Since this JSF version, the JSF managed bean▐"

并且在Hacks课程中:

    // GlassFish related ----------------------------------------------------------------------------------------------

    /**
     * Returns <code>true</code> if CDI is available in GlassFish.
     * @param servletContext The involved servlet context.
     * @return <code>true</code> if CDI is available in GlassFish.
     */
    public static boolean isCDIAvailableInGlassFish(ServletContext servletContext) {
            return servletContext.getAttribute("org.glassfish.jsp.beanManagerELResolver") instanceof ELResolver;
    }

是否有可能为OWB提供这样的特殊情况? 测试一个属性设置对我来说是公平的。

或者是否可以推迟omnifaces instanciation?

最后,为什么不等待CDI通知,使用如下方法:

public class CDIStartup {

    public void postConstruct(@Observes @Initialized(ApplicationScoped.class) Object o) {
        // CDI Ready    }
}

1 个答案:

答案 0 :(得分:3)

OmniFaces需要更改支票代码,因为它是非便携式的。 CDI规范没有定义BeanManager或任何Context需要在ServletContainerInitializer中可用。这在很大程度上取决于目标环境和集成场景,因此非常不便携。 与旧版本完美无缺地相比,这也是一种回归。

将它移动到ServletContextListener,或使其成为警告并完成。