1

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-resource-1.5.0.jar
  • openwebbeans-jsf-1.5.0.jar
  • openwebbeans-impl-1.5.0.jar
  • openwebbeans-el22-1.5.0.jar
  • xbean-finder-shaded-4.1.jar
  • xbean-asm5-shaded-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
  • commons-digester-1.8.jar
  • commons-beanutils-1.8.3.jar
  • commons-collections-3.2.jar
  • commons-logging-1.1.1.jar
  • commons-codec-1.3.jar

また、優れた omnifaces ライブラリを使用することも大好きです。したがって、私の webapp には依存関係として omnifaces があり、WEB-INF/lib にあります。

私が使用している 2 つのバージョン、1.8.1 と 2.0 の CDI には問題があります。openwebbeans が開始される前に omnifaces が開始されるように思われるため、CDI が見つかりません。

1.8.1 では、この問題によって例外が発生しますが、このバージョンでは CDI が必須ではないため、ブロックされません。2.0 では、omnifaces 2.0 には要件として CDI があるため、webapp の起動が妨げられます。

1.8.1 では、ログは次のとおりです。

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

この問題はオムニフェイスでのみ発生します。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 にそのような特殊なケースがある可能性はありますか? 属性が設定されていることをテストすることは、私にとって十分公平です。

または、オムニフェイスのインスタンス化を延期することは可能ですか?

最後に、次のような方法で CDI 通知を待ちませんか。

public class CDIStartup {

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

1 に答える 1

3

OmniFaces は移植性がないため、チェック コードを変更する必要があります。CDI 仕様では、BeanManager もコンテキストも ServletContainerInitializer で使用可能である必要があると定義していません。これは、ターゲット環境と統合シナリオに大きく依存するため、非常に移植性がありません。これは、問題なく動作していた古いバージョンと比較した場合の回帰でもあります。

それをServletContextListenerに移動するか、警告にして完了してください。

于 2015-05-22T15:48:01.273 に答える