Initialization fail on Tomcat+OWB #133

Closed
BalusC opened this Issue May 22, 2015 · 24 comments

Projects

None yet

3 participants

@BalusC
Member
BalusC commented May 22, 2015

http://stackoverflow.com/q/30385007/157882

OWB initializes using a ServletContextListener while OmniFaces validates CDI in ServletContainerInitializer.

@BalusC BalusC added a commit that closed this issue May 26, 2015
@BalusC BalusC Fix #133 Moved CDI check from initializer to listener and replace
@WebListener by ServletContext#addListener() to guarantee that listener
also runs even with metadata-complete=true.
f8d929d
@BalusC BalusC closed this in f8d929d May 26, 2015
@BalusC BalusC added a commit that referenced this issue May 27, 2015
@BalusC BalusC #133 revert programmatic registration of listener as otherwise an
UnsupportedOperationException is thrown during
ServletContext#getServletRegistrations().
739048e
@lpenet
lpenet commented May 27, 2015

I am very sorry, but when I try this fix, I got the following error logs :

Using CATALINA_BASE:   /opt/apache-tomcat-8.0.22
Using CATALINA_HOME:   /opt/apache-tomcat-8.0.22
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.22/temp
Using JRE_HOME:        /usr/lib/jvm/java-8-openjdk-amd64
Using CLASSPATH:       /opt/apache-tomcat-8.0.22/bin/bootstrap.jar:/opt/apache-tomcat-8.0.22/bin/tomcat-juli.jar
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=1024M; support was removed in 8.0
Listening for transport dt_socket at address: 11550
27-May-2015 18:33:11.054 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.22
27-May-2015 18:33:11.055 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Apr 29 2015 11:46:15 UTC
27-May-2015 18:33:11.055 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.22.0
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.0.0-1-amd64
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-openjdk-amd64/jre
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_45-internal-b14
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/apache-tomcat-8.0.22
27-May-2015 18:33:11.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/apache-tomcat-8.0.22
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/apache-tomcat-8.0.22/conf/logging.properties
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|dsi-penet
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024M
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+CMSClassUnloadingEnabled
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.el.parser.COERCE_TO_ZERO=false
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djavax.net.ssl.trustStore=/opt/apache-tomcat-7.0.39/conf/cacerts
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=11550,server=y,suspend=n
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/opt/apache-tomcat-8.0.22/endorsed
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/apache-tomcat-8.0.22
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/apache-tomcat-8.0.22
27-May-2015 18:33:11.060 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/apache-tomcat-8.0.22/temp
27-May-2015 18:33:11.061 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/i386::/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
27-May-2015 18:33:11.134 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
27-May-2015 18:33:11.149 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
27-May-2015 18:33:11.151 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8443"]
27-May-2015 18:33:11.259 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
27-May-2015 18:33:11.261 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
27-May-2015 18:33:11.264 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
27-May-2015 18:33:11.264 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 503 ms
27-May-2015 18:33:11.288 INFO [main] org.apache.catalina.core.StandardService.startInternal Démarrage du service Catalina
27-May-2015 18:33:11.288 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.22
27-May-2015 18:33:11.315 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Déploiement du descripteur de configuration /opt/apache-tomcat-8.0.22/conf/Catalina/localhost/apps#presences#admin.xml
27-May-2015 18:33:13.156 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.
27-May-2015 18:33:13.188 INFO [localhost-startStop-1] org.omnifaces.ApplicationInitializer.logOmniFacesVersion Using OmniFaces version 2.1-SNAPSHOT
27-May-2015 18:33:13.356 SEVERE [localhost-startStop-1] org.apache.webbeans.web.tomcat7.TomcatInstanceManager.inject Error is occured while injecting the OpenWebBeans dependencies for instance org.omnifaces.ApplicationListener@4c1b05d
 javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.EagerBeansRepository] 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:76)
    at org.apache.catalina.core.ApplicationContext.createListener(ApplicationContext.java:1335)
    at org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1237)
    at org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:636)
    at org.omnifaces.ApplicationInitializer.onStartup(ApplicationInitializer.java:49)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
    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:586)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750)
    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)

27-May-2015 18:33:13.550 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
27-May-2015 18:33:13.629 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.EagerBeansWebListener@7cd1ffbf
 javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.EagerBeansRepository] 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:4651)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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:586)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750)
    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)

27-May-2015 18:33:13.639 INFO [localhost-startStop-1] org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication OpenWebBeans Container is starting...
27-May-2015 18:33:13.641 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [TomcatWebPlugin]
27-May-2015 18:33:13.642 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
27-May-2015 18:33:13.647 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-core-impl-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.654 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-jsf-module-api-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.655 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-jpa-module-impl-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.657 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/mnt/ssd/home_bis/devoss/omnifaces/target/omnifaces-2.1-SNAPSHOT.jar!/META-INF/beans.xml
27-May-2015 18:33:13.659 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-jpa-module-api-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.660 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-security-module-impl-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.661 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-security-module-api-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.662 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-jsf-module-impl-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.663 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-core-api-1.3.0.jar!/META-INF/beans.xml
27-May-2015 18:33:13.664 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/adminpresences/target/admin%23%231.0-SNAPSHOT/WEB-INF/classes/META-INF/beans.xml
27-May-2015 18:33:13.665 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/adminpresences/target/admin%23%231.0-SNAPSHOT/WEB-INF/lib/deltaspike-jsf-module-api-1.

and

27-May-2015 18:33:17.456 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.omnifaces.ApplicationListener
 java.lang.NullPointerException
    at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:63)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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:586)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750)
    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)

27-May-2015 18:33:18.866 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.omnifaces.ApplicationListener
 java.lang.NullPointerException
    at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:63)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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.deployDirectory(HostConfig.java:1101)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
    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)

27-May-2015 18:33:19.777 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
27-May-2015 18:33:19.777 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
27-May-2015 18:33:19.777 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.omnifaces.ApplicationListener
 java.lang.NullPointerException
    at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:63)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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.deployDirectory(HostConfig.java:1101)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
    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)

27-May-2015 18:33:19.778 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.ManagedBeanDestroyerListener', 'org.apache.myfaces.webapp.ManagedBeanDestroyerListener@4f9e7305')
27-May-2015 18:33:19.778 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.ServiceProviderFinder', 'org.apache.myfaces.spi.impl.DefaultServiceProviderFinder@333a7d04')
27-May-2015 18:33:19.778 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.WebConfigProviderFactory', 'org.apache.myfaces.spi.impl.DefaultWebConfigProviderFactory@4c16eae4')
27-May-2015 18:33:19.778 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.WebConfigProvider.LIST', '[]')
27-May-2015 18:33:19.781 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.shared_impl.webapp.webxml.WebXml', 'org.apache.myfaces.shared_impl.webapp.webxml.WebXml@195d4004')
27-May-2015 18:33:19.781 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.shared.config.MyfacesConfig', 'org.apache.myfaces.shared.config.MyfacesConfig@25670e71')
27-May-2015 18:33:19.787 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('oam.cdi.BEAN_MANAGER_INSTANCE', 'org.apache.webbeans.container.InjectableBeanManager@3cdebd92')
27-May-2015 18:33:19.788 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.jasper.runtime.JspApplicationContextImpl', 'org.apache.jasper.runtime.JspApplicationContextImpl@b715ed6')
27-May-2015 18:33:19.788 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.config.RuntimeConfig', 'org.apache.myfaces.config.RuntimeConfig@c397536')
27-May-2015 18:33:19.788 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.BEAN_ENTRY_STORAGE', '[]')
27-May-2015 18:33:19.788 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigurationMergerFactory', 'org.apache.myfaces.spi.impl.DefaultFacesConfigurationMergerFactory@5f128f6')
27-May-2015 18:33:19.788 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigurationMerger.INSTANCE', 'org.apache.myfaces.config.DefaultFacesConfigurationMerger@4c0d381e')
27-May-2015 18:33:19.789 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigurationProviderFactory', 'org.apache.myfaces.spi.impl.DefaultFacesConfigurationProviderFactory@4d8b48a7')
27-May-2015 18:33:19.789 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigurationProvider.LIST', '[]')
27-May-2015 18:33:19.789 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigurationProvider.INSTANCE', 'org.apache.myfaces.config.DefaultFacesConfigurationProvider@adc04e5')
27-May-2015 18:33:19.836 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.AnnotationProviderFactory', 'org.apache.myfaces.spi.impl.DefaultAnnotationProviderFactory@7c1a96d6')
27-May-2015 18:33:19.836 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.AnnotationProvider.LIST', '[]')
27-May-2015 18:33:19.837 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.AnnotationProvider.INSTANCE', 'org.apache.myfaces.config.annotation.DefaultAnnotationProvider@59e8100a')
27-May-2015 18:33:19.942 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigResourceProviderFactory', 'org.apache.myfaces.spi.impl.DefaultFacesConfigResourceProviderFactory@2e739f59')
27-May-2015 18:33:19.942 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesConfigResourceProvider.LIST', '[]')
27-May-2015 18:33:19.977 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FaceletConfigResourceProviderFactory', 'org.apache.myfaces.spi.impl.DefaultFaceletConfigResourceProviderFactory@256d430f')
27-May-2015 18:33:19.978 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FaceletConfigResourceProvider.LIST', '[]')
27-May-2015 18:33:20.010 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.InjectionProviderFactory', 'org.apache.myfaces.spi.impl.DefaultInjectionProviderFactory@58ceff9')
27-May-2015 18:33:20.011 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.InjectionProvider.INJECTION_PROVIDER_INSTANCE', 'org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider@46e6755c')
27-May-2015 18:33:20.012 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.application.ApplicationImpl', 'org.apache.myfaces.application.ApplicationImpl@17b00b2a')
27-May-2015 18:33:20.017 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.ResourceLibraryContractsProviderFactory', 'org.apache.myfaces.spi.impl.DefaultResourceLibraryContractsProviderFactory@39f981e2')
27-May-2015 18:33:20.018 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.ResourceLibraryContractsProvider.LIST', '[]')
27-May-2015 18:33:20.020 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.SERIAL_FACTORY', 'org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory@78605a8')
27-May-2015 18:33:20.021 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.config.annotation.LifecycleProviderFactory', 'org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory@237a656d')
27-May-2015 18:33:20.021 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.config.annotation.LifecycleProvider.LIFECYCLE_PROVIDER_INSTANCE', 'org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider@2bb22066')
27-May-2015 18:33:20.022 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.spi.FacesFlowProviderFactory', 'org.apache.myfaces.spi.impl.DefaultFacesFlowProviderFactory@7c663b8e')
27-May-2015 18:33:20.022 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('org.apache.myfaces.webapp.StartupServletContextListener.FACES_INIT_DONE', 'true')
27-May-2015 18:33:20.024 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
27-May-2015 18:33:20.024 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
27-May-2015 18:33:20.454 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.omnifaces.ApplicationListener
 java.lang.NullPointerException
    at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:63)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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.deployDirectory(HostConfig.java:1101)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
    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)
@BalusC
Member
BalusC commented May 27, 2015

@lpenet Hmm, I wish I saw this before releasing 2.1-RC2 around the same time. The only change as compared to your code is a reverted programmatic registration (now it uses @WebListener again) but I don't think it would solve the problem.

If it doesn't, would you be so kind to tell the OWB version and JARs used so I can reproduce it on my Tomcat 8.0.22? I've actually never got OWB successfully to run on Tomcat (without Maven) and relied on TomEE only. I tried reproducing this with OWB 1.5.0 with below JARs from binary distribution zip placed in WEB-INF/lib.

  • geronimo-atinject_1.0_spec-1.0.jar
  • geronimo-jcdi_1.1_spec-1.0.jar
  • openwebbeans-el22-1.5.0.jar
  • openwebbeans-impl-1.5.0.jar
  • openwebbeans-spi-1.5.0.jar
  • openwebbeans-tomcat7-1.5.0.jar
  • openwebbeans-web-1.5.0.jar

But I end up getting Caused by: java.lang.ClassNotFoundException: org.apache.xbean.finder.AnnotationFinder which suggests I need OpenEJB as well, which is confusing as OpenWebBeans documentation isn't exactly clear on this. The documentation also mentions two more Geronimo JARs and a jsf22 JAR, but I couldn't find them in the zip.

@struberg

Hi Bauke! If it helps then we could do a hangout looking at the code together? I have not yet looked much at Omnifaces details so it's probably better we do this together?
LieGrue,
strub

@struberg

java.lang.ClassNotFoundException: org.apache.xbean.finder.AnnotationFinder

You don't need OpenEJB. This is part of geronimo xbean-finder.
You also need

  • geronimo-xbean-asm5 (a shaded version of ASM5 to prevent classpath clashes).
  • geronimo-interceptors-1.2_spec-1.0.jar
  • geronimo-annotations-1.2_spec-1.0.jar
@lpenet
lpenet commented May 27, 2015

I will try to give you that along with my tomcat web.xml, server.xml and context.xml tonight.

I also put other stuff there : myfaces, deltaspike, home-made jars... and omnifaces. :)

Thanks !

Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.

@BalusC
Member
BalusC commented May 27, 2015

@struberg I followed the documentation here http://openwebbeans.apache.org/owbsetup_ee.html and I downloaded the 1.5.0 binary here http://openwebbeans.apache.org/download.html.

I figured that the last two geronimo JARs (interceptor and annotation) were missing in the 1.5.0 binary zip, so I assumed the documentation was outdated and targeted at an older OWB version. In any case, I also tried downloading 1.2.7 from a mirror linked via download page here http://www.apache.org/dyn/closer.cgi/openwebbeans/1.2.7/openwebbeans-distribution-1.2.7-binary.zip but any mirror returns 404 for me. I'll try finding those JARs individually somewhere.

OmniFaces is for now not relevant. Most important is to get OWB to work on Tomcat (without OmniFaces). This way I can continue testing OmniFaces on it.

@struberg

I'm currently working on getting our binary distribution jar fixed. I am also currently working on a Docker image for tomcat8+owb-1.6.0 :)
If you have some Docker fuu then feel free to help out ;)

@BalusC
Member
BalusC commented May 27, 2015

Finally got it to run after adding the below JARs to the list:

  • geronimo-annotation_1.2_spec-1.0.jar
  • geronimo-interceptor_1.2_spec-1.0.jar
  • xbean-asm5-shaded-4.2.jar
  • xbean-finder-shaded-4.2.jar
  • openwebbeans-jsf-1.5.0.jar (this was actually what the documentation meant with jsf22)

And the below META-INF/context.xml:

<Context>
    <Resource name="BeanManager"
        auth="Container"
        type="javax.enterprise.inject.spi.BeanManager"
        factory="org.apache.webbeans.container.ManagerObjectFactory" />
</Context>

Basic JSF (Mojarra 2.2.11) with a @Named @ViewScoped worked fine.

After adding OmniFaces, I needed bean validation API (because OWB inspected a class which had a BV dependency in spite of it being veto'ed by VetoAnnotatedTypeExtension). But then I indeed got that NPE in ApplicationListener because OWB didn't seem to @Inject the EagerBeansRepository in there. I will investigate that part.

@BalusC BalusC added a commit that referenced this issue May 27, 2015
@BalusC BalusC #133 OWB didn't @Inject the EagerBeansRepository in @WebListener, let's
manually grab it
25d02e4
@lpenet
lpenet commented May 27, 2015

BalusC : the jars I put in tomcat/lib are :

antlr-2.7.7.jar
commons-beanutils-1.8.3.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-lang3-3.1.jar
commons-logging-1.1.1.jar
deltaspike-bean-validation-module-impl-1.3.0.jar
deltaspike-core-api-1.3.0.jar
deltaspike-core-impl-1.3.0.jar
deltaspike-jpa-module-api-1.3.0.jar
deltaspike-jpa-module-impl-1.3.0.jar
deltaspike-jsf-module-api-1.3.0.jar
deltaspike-jsf-module-impl-1.3.0.jar
deltaspike-security-module-api-1.3.0.jar
deltaspike-security-module-impl-1.3.0.jar
dom4j-1.6.1.jar
geronimo-annotation_1.2_spec-1.0.jar
geronimo-atinject_1.0_spec-1.0.jar
geronimo-interceptor_1.2_spec-1.0.jar
geronimo-jcdi_1.1_spec-1.0.jar
geronimo-validation_1.0_spec-1.1.jar
hibernate-commons-annotations-4.0.5.Final.jar
hibernate-core-4.3.8.Final.jar
hibernate-entitymanager-4.3.8.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
jandex-1.1.0.Final.jar
javassist-3.18.1-GA.jar
jboss-logging-3.1.3.GA.jar
jboss-logging-annotations-1.2.0.Beta1.jar
jboss-transaction-api_1.2_spec-1.0.0.Final.jar
jstl-1.2.jar
myfaces-api-2.2.8.jar
myfaces-impl-2.2.8.jar
openwebbeans-el22-1.5.0.jar
openwebbeans-impl-1.5.0.jar
openwebbeans-jsf-1.5.0.jar
openwebbeans-resource-1.5.0.jar
openwebbeans-spi-1.5.0.jar
openwebbeans-tomcat7-1.5.0.jar
openwebbeans-web-1.5.0.jar
xbean-asm5-shaded-4.1.jar
xbean-finder-shaded-4.1.jar
xml-apis-1.0.b2.jar

If it can help you, I use the following maven artefact, which itselfs prepare a RPM for installation on production systems :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <groupId>fr.senat.presences</groupId>
    <artifactId>jsf-stack</artifactId>
    <description>Pile OpenWebBeans / MyFaces / DeltaSpike / OmniFaces / JPA / Hibernate</description>

    <prerequisites>
        <maven>3.2.3</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
    </properties>

    <distributionManagement>
        <repository>
            <id>senat-repository</id>
            <url>http://poppo.senat.fr/nexus/content/repositories/senat</url>
        </repository>
        <snapshotRepository>
            <id>senat-snapshots-repository</id>
            <url>http://poppo.senat.fr/nexus/content/repositories/senat-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <scm>
        <connection>scm:git:ssh://mcweb@git/home/mcweb/git/presences/jsf-stack.git</connection>
        <developerConnection>scm:git:ssh://mcweb@git/home/mcweb/git/presences/jsf-stack.git</developerConnection>
        <url>http://git.senat.fr/git/?p=presences/jsf-stack.git</url>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jcdi_1.1_spec</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-interceptor_1.2_spec</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-annotation_1.2_spec</artifactId>
        </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-validation_1.0_spec</artifactId>
    </dependency>

    <!-- jstl -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <!-- JSF -->
        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-impl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.omnifaces</groupId>
            <artifactId>omnifaces</artifactId>
        </dependency>

    <!-- OpenWebBeans -->
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-spi</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-tomcat7</artifactId>
            <scope>runtime</scope>
        </dependency>

    <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-jsf</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-web</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-el22</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-resource</artifactId>
            <scope>runtime</scope>
        </dependency>


        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-bean-validation-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jpa-module-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jpa-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jsf-module-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jsf-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.1</version>
            </dependency>

            <!-- Specifications -->
            <!-- JSR-330 -->
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-atinject_1.0_spec</artifactId>
                <version>1.0</version>
            </dependency>

            <!-- JSR-299 -->
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-jcdi_1.1_spec</artifactId>
                <version>1.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-interceptor_1.2_spec</artifactId>
                <version>1.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-validation_1.0_spec</artifactId>
                <version>1.1</version>
            </dependency>

            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-servlet_3.0_spec</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- JSR-250 API -->
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-annotation_1.2_spec</artifactId>
                <version>1.0</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                    <groupId>org.jboss.spec.javax.faces</groupId>
                    <artifactId>jboss-jsf-api_2.2_spec</artifactId>
                    <version>2.2.10</version>
                    <scope>provided</scope>
            </dependency>

            <!-- jstl -->
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>

            <!-- JSF -->
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-api</artifactId>
                <version>2.2.8</version>
            </dependency>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-impl</artifactId>
                <version>2.2.8</version>
            </dependency>

            <dependency>
                <groupId>org.omnifaces</groupId>
                <artifactId>omnifaces</artifactId>
                <version>2.1-SNAPSHOT</version>
            </dependency>

            <!-- OpenWebBeans -->
            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-spi</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-tomcat7</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-jsf</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-web</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-el22</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-resource</artifactId>
                <version>1.5.0</version>
            </dependency>


            <dependency>
                <groupId>org.apache.deltaspike.core</groupId>
                <artifactId>deltaspike-core-api</artifactId>
                <version>1.3.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.core</groupId>
                <artifactId>deltaspike-core-impl</artifactId>
                <version>1.3.0</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-bean-validation-module-api</artifactId>
                <version>1.3.0</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-bean-validation-module-impl</artifactId>
                <version>1.3.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-jpa-module-api</artifactId>
                <version>1.3.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-jpa-module-impl</artifactId>
                <version>1.3.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-jsf-module-api</artifactId>
                <version>1.3.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-jsf-module-impl</artifactId>
                <version>1.3.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>4.3.8.Final</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>

            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-catalina</artifactId>
                <version>8.0.22</version>
            </dependency>
        </dependencies>

    </dependencyManagement>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.1.12</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                         </goals>
                    </execution>
                </executions>

                <configuration>
                    <!-- that's the default value, you don't have to set it -->
                    <prefix>git</prefix>

                    <!-- that's the default value -->
                    <dateFormat>dd/MM/yyyy &agrave; HH:mm:ss z</dateFormat>

                    <!-- false is default here, it prints some more information during the build -->
                    <verbose>false</verbose>

                    <!-- @since 2.1.10 -->
                    <!-- 
                      false is default here, if set to true it uses native `git` excutable for extracting all data.
                      This usualy has better performance than the default (jgit) implemenation, but requires you to 
                      have git available as executable for the build as well as *might break unexpectedly* when you 
                      upgrade your system-wide git installation.

                      As rule of thumb - stay on `jgit` (keep this `false`) until you notice performance problems.
                    -->
                    <useNativeGit>false</useNativeGit>

                    <!--
                        If you'd like to tell the plugin where your .git directory is,
                        use this setting, otherwise we'll perform a search trying to
                        figure out the right directory. It's better to add it explicite IMHO.
                    -->
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>

                    <!-- ALTERNATE SETUP - GENERATE FILE -->
                    <!--
                        If you want to keep git information, even in your WAR file etc,
                        use this mode, which will generate a properties file (with filled out values)
                        which you can then normally read using new Properties().load(/**/)
                    -->

                    <!--
                        this is true by default; You may want to set this to false, if the plugin should run inside a
                        <packaging>pom</packaging> project. Most projects won't need to override this property.

                        For an use-case for this kind of behaviour see: https://github.com/ktoso/maven-git-commit-id-plugin/issues/21
                    -->
                    <skipPoms>true</skipPoms>

                    <!-- true by default, controls whether the plugin will fail when no .git directory is found, when set to false the plugin will just skip execution -->
                    <!-- @since 2.0.4 -->
                    <failOnNoGitDirectory>true</failOnNoGitDirectory>

                    <!-- @since v2.0.4 -->
                    <!--
                         Controls the length of the abbreviated git commit it (git.commit.id.abbrev)

                         Defaults to `7`.
                         `0` carries the special meaning.
                         Maximum value is `40`, because of max SHA-1 length.
                     -->
                    <abbrevLength>7</abbrevLength>

                    <!-- @since 2.1.8 -->
                    <!--
                        skip the plugin execution completely. This is useful for e.g. profile activated plugin invocations or
                        to use properties to enable / disable pom features. Default value is 'false'.
                    -->
                    <skip>false</skip>

                    <!-- @since 2.1.12 -->
                    <!--
                       Use with caution!

                       In a multi-module build, only run once. This means that the plugins effects will only execute once, for the parent project.
                       This probably won't "do the right thing" if your project has more than one git repository.

                       Important: If you're using `generateGitPropertiesFile`, setting `runOnlyOnce` will make the plugin
                       only generate the file in the directory where you started your build (!).

                       The `git.*` maven properties are available in all modules.
                       Default value is `false`.
                    -->
                    <runOnlyOnce>false</runOnlyOnce>

                    <!-- @since 2.1.9 -->
                    <!--
                        Can be used to exclude certain properties from being emited into the resulting file.
                        May be useful when you want to hide {@code git.remote.origin.url} (maybe because it contains your repo password?),
                        or the email of the committer etc.

                        Each value may be globbing, that is, you can write {@code git.commit.user.*} to exclude both, the {@code name},
                        as well as {@code email} properties from being emitted into the resulting files.

                        Please note that the strings here are Java regexes ({@code .*} is globbing, not plain {@code *}).
                    -->
                    <excludeProperties>
                      <!-- <excludeProperty>git.user.*</excludeProperty> -->
                    </excludeProperties>


                    <!-- @since 2.1.0 -->
                    <!-- 
                        read up about git-describe on the in man, or it's homepage - it's a really powerful versioning helper 
                        and the recommended way to use git-commit-id-plugin. The configuration bellow is optional, 
                        by default describe will run "just like git-describe on the command line", even though it's a JGit reimplementation.
                    -->
                    <gitDescribe>

                        <!-- don't generate the describe property -->
                        <skip>false</skip>

                        <!-- 
                            if no tag was found "near" this commit, just print the commit's id instead, 
                            helpful when you always expect this field to be not-empty 
                        -->
                        <always>false</always>
                        <!--
                             how many chars should be displayed as the commit object id? 
                             7 is git's default, 
                             0 has a special meaning (see end of this README.md), 
                             and 40 is the maximum value here 
                        -->
                        <abbrev>7</abbrev>

                        <!-- when the build is triggered while the repo is in "dirty state", append this suffix -->
                        <dirty>-dirty</dirty>

                        <!-- Only consider tags matching the given pattern. This can be used to avoid leaking private tags from the repository. -->
                        <match>*</match>

                        <!-- 
                             always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag. 
                             The distance will always be 0 if you're "on" the tag. 
                        -->
                        <forceLongFormat>false</forceLongFormat>
                    </gitDescribe>
                </configuration>

            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>rpm-maven-plugin</artifactId>
                <version>2.0.1</version>
                <configuration>
                    <name>${project.artifactId}</name>
                    <group>${project.groupId}</group>
                    <packager>${user.name}</packager>
                    <needarch>noarch</needarch>
                    <copyright>Le Sénat</copyright>

                    <defaultFilemode>644</defaultFilemode>
                    <defaultUsername>tomcat</defaultUsername>
                    <defaultGroupname>tomcat</defaultGroupname>
                    <defaultDirmode>755</defaultDirmode>

                    <requires>
                        <require>java &gt;= 1.8</require>
                        <require>oracle-instantclient11.2-basic &gt;= 11.2.0.3.0</require>
                        <require>postgresql-jdbc &gt;= 9.0.801</require>
                    </requires>
                    <provides>
                        <provide>${project.artifactId}</provide>
                    </provides>
                    <mappings>
                        <mapping>
                <directory>/path/to/tomcat/lib/dir</directory>
                <!-- inclut tous les jar de dépendances dans le RPM, sauf exclusions ci-dessous -->
                            <dependency>
                                <excludes>
                                    <exclude>org.apache.geronimo.specs:geronimo-servlet_3.0_spec</exclude>
                                </excludes>
                            </dependency>
                            <directoryIncluded>false</directoryIncluded>
                        </mapping>
                    </mappings>
            </configuration>
            </plugin>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2.1</version>
              <configuration>
                <executable>rhnpush</executable>
                <workingDirectory>${project.build.directory}/rpm/${project.artifactId}/RPMS/noarch/</workingDirectory>
                <arguments>
                  <argument>-c</argument>
                  <argument>general_devel-senat-interne-rhel6-x86_64</argument>
                  <argument>-d</argument>
                  <argument>.</argument>
                  <argument>-u</argument>
                  <argument>${spacewalk.login}</argument>
                  <argument>-p</argument>
                  <argument>${spacewalk.password}</argument>
                  <argument>--server</argument>
                  <argument>spacewalk.senat.fr</argument>
                  <argument>--verbose</argument>
                </arguments>
              </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>rpmbuild</id>
            <activation>
                <file>
                    <exists>/usr/bin/rpmbuild</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>rpm-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>attached-rpm</goal>
                                </goals>
                                <configuration>
                                    <keyname>12345678</keyname>
                                    <keyPassphrase>
                                        <passphrase>*********</passphrase>
                                    </keyPassphrase>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    <profile>
            <id>rhnpush</id>
            <activation>
                <file>
                        <exists>/usr/bin/rhnpush</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
    </profile>
    </profiles>
</project>

The

                            <dependency>
                                <excludes>
                                    <exclude>org.apache.geronimo.specs:geronimo-servlet_3.0_spec</exclude>
                                </excludes>
                            </dependency>

is quite handy. It includes recursively all jars dependencies, except there org.apache.geronimo.specs:geronimo-servlet_3.0_spec

In web.xml, I tried to add

  <resource-env-ref>
        <resource-env-ref-name>BeanManager</resource-env-ref-name>
        <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
  </resource-env-ref>

along with

    <Resource name="BeanManager" 
        auth="Container"
        type="javax.enterprise.inject.spi.BeanManager"
        factory="org.apache.webbeans.container.ManagerObjectFactory" />

in context.xml

But is does not help.

Tomcat context.xml contains a

I can give you a zip of my tomcat to unpack if it can help you. Mail me at ludovic AT penet DOT org if you are interested.

@BalusC
Member
BalusC commented May 27, 2015

Not sure why OWB+Tomcat didn't @Inject it in @WebListener, it worked when injected in a regular @Named test bean. For now I workarounded it by manually grabbing the bean from BeanManager rather than relying on @Inject. After that, it deployed successfully.

@lpenet Can you try today's latest 2.1-SNAPSHOT? https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnifaces/2.1-SNAPSHOT/

@lpenet
lpenet commented May 27, 2015

ok, I try it immediatly.

@lpenet
lpenet commented May 27, 2015

ok, I have :

27-May-2015 22:38:16.160 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 428 ms
27-May-2015 22:38:16.180 INFO [main] org.apache.catalina.core.StandardService.startInternal Démarrage du service Catalina
27-May-2015 22:38:16.180 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.22
27-May-2015 22:38:16.191 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Déploiement du descripteur de configuration /opt/apache-tomcat-8.0.22/conf/Catalina/localhost/apps#presences#admin.xml
27-May-2015 22:38:17.761 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.
27-May-2015 22:38:17.761 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.
27-May-2015 22:38:17.761 INFO [localhost-startStop-1] org.apache.catalina.core.StandardContext.addApplicationListener The listener "org.apache.webbeans.web.tomcat7.TomcatSecurityFilter" is already configured for this context. The duplicate definition has been ignored.
27-May-2015 22:38:17.785 INFO [localhost-startStop-1] org.omnifaces.ApplicationInitializer.logOmniFacesVersion Using OmniFaces version 2.1-SNAPSHOT
27-May-2015 22:38:17.957 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
27-May-2015 22:38:18.149 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.EagerBeansWebListener@2e489099
 javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.omnifaces.cdi.eager.EagerBeansRepository] 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:4651)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
        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:586)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750)
        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)

27-May-2015 22:38:18.157 INFO [localhost-startStop-1] org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication OpenWebBeans Container is starting...
27-May-2015 22:38:18.160 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [TomcatWebPlugin]
27-May-2015 22:38:18.160 INFO [localhost-startStop-1] org.apache.webbeans.plugins.PluginLoader.startUp Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
27-May-2015 22:38:18.164 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-core-impl-1.3.0.jar!/META-INF/beans.xml
27-May-2015 22:38:18.170 INFO [localhost-startStop-1] org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery.addWebBeansXmlLocation added beans archive URL: jar:file:/opt/apache-tomcat-8.0.22/lib/deltaspike-jsf-module-api-1.3.0.jar!/META-INF/beans.xml

[...]

27-May-2015 22:38:22.904 INFO [localhost-startStop-1] org.apache.myfaces.config.DefaultFacesConfigurationProvider.getClassloaderFacesConfig Reading config : jar:file:/opt/apache-tomcat-8.0.22/lib/openwebbeans-jsf-1.5.0.jar!/META-INF/faces-config.xml
27-May-2015 22:38:22.938 INFO [localhost-startStop-1] org.apache.myfaces.config.LogMetaInfUtils.logArtifact Artifact 'myfaces-api' was found in version '2.2.8' from path 'file:/opt/apache-tomcat-8.0.22/lib/myfaces-api-2.2.8.jar'
27-May-2015 22:38:22.938 INFO [localhost-startStop-1] org.apache.myfaces.config.LogMetaInfUtils.logArtifact Artifact 'myfaces-impl' was found in version '2.2.8' from path 'file:/opt/apache-tomcat-8.0.22/lib/myfaces-impl-2.2.8.jar'
27-May-2015 22:38:22.939 INFO [localhost-startStop-1] org.apache.myfaces.spi.impl.DefaultInjectionProviderFactory.getInjectionProvider Using InjectionProvider org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider
27-May-2015 22:38:22.946 INFO [localhost-startStop-1] org.apache.myfaces.application.ApplicationImpl.getProjectStage Couldn't discover the current project stage, using Production
27-May-2015 22:38:22.946 INFO [localhost-startStop-1] org.apache.myfaces.config.FacesConfigurator.handleSerialFactory Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
27-May-2015 22:38:22.947 INFO [localhost-startStop-1] org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory.getLifecycleProvider Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
27-May-2015 22:38:22.948 SEVERE [localhost-startStop-1] org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces An error occured while initializing MyFaces: It's not allowed to call getBeans(Type, Annotation...) before AfterBeanDiscovery
 java.lang.IllegalStateException: It's not allowed to call getBeans(Type, Annotation...) before AfterBeanDiscovery
        at org.apache.webbeans.container.InjectableBeanManager.checkAfterBeanDiscoveryProcessed(InjectableBeanManager.java:402)
        at org.apache.webbeans.container.InjectableBeanManager.getBeans(InjectableBeanManager.java:121)
        at org.apache.myfaces.cdi.util.CDIUtils.lookup(CDIUtils.java:69)
        at org.apache.myfaces.flow.cdi.DefaultCDIFacesFlowProvider.getAnnotatedFlows(DefaultCDIFacesFlowProvider.java:51)
        at org.apache.myfaces.flow.impl.AnnotatedFlowConfigurator.configureAnnotatedFlows(AnnotatedFlowConfigurator.java:42)
        at org.apache.myfaces.config.FacesConfigurator.configureFlowHandler(FacesConfigurator.java:1666)
        at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:608)
        at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:416)
        at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
        at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:172)
        at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
        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.deployDirectory(HostConfig.java:1101)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
        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)

27-May-2015 22:38:22.949 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/apache-tomcat-8.0.22/webapps/ROOT has finished in 778 ms
27-May-2015 22:38:22.949 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Déploiement du répertoire /opt/apache-tomcat-8.0.22/webapps/examples de l'application web
27-May-2015 22:38:23.484 INFO [localhost-startStop-1] null.null Added FacesServlet with mappings=[/faces/*, *.jsf, *.faces]

[this last error two times]

@lpenet
lpenet commented May 27, 2015

Important note : it works despite those errors. I would really love to see them away, but the essential point is that it works.

@BalusC
Member
BalusC commented May 27, 2015

Haven't seen the first one. Perhaps a different library version somewhere. Last one seem to be specific to MyFaces. I was using Mojarra 2.2.11 (on Tomcat 8.0.23).

Cool that it runs regardless (only OmniFaces @Eager won't work). I will look at that other @WebListener injection issue.

@lpenet
lpenet commented May 27, 2015

Yes, I agree on @Eager, but as you guessed, I do not use it. It seems to me that we should try to avoid injection in this listener too, like what you do in ApplicationListener. Will try a patch...

@BalusC
Member
BalusC commented May 27, 2015

Yes, only .. It works with WildFly+Weld. It works with Tomcat+Weld. It works in TomEE+OWB. It intrigues me why Tomcat+OWB didn't like it. It's undoubtedly related to that UnsatisfiedResolutionException why it couldn't be injected in both listeners, only I don't understand that part yet. If I could fix that exception on EagerBeansRepository, then I think OWB should just happily @Inject it in both listeners.

@lpenet
lpenet commented May 27, 2015

As former PMC of OWB, Mark is certainly the person who can explain it to us... :-)

With the following patch, even eager beans seem to work :

diff --git a/src/main/java/org/omnifaces/cdi/eager/EagerBeansWebListener.java b/src/main/java/org/omnifaces/cdi/eager/EagerBeansWebListener.java
index 08ebcd9..f9026b9 100644
--- a/src/main/java/org/omnifaces/cdi/eager/EagerBeansWebListener.java
+++ b/src/main/java/org/omnifaces/cdi/eager/EagerBeansWebListener.java
@@ -29,6 +29,7 @@ import javax.servlet.annotation.WebListener;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
+import org.omnifaces.config.BeanManager;

 /**
  * <p>
@@ -53,9 +54,15 @@ public class EagerBeansWebListener implements HttpSessionListener, ServletReques

        private static boolean disabled;

-       @Inject
        private EagerBeansRepository eagerBeansRepository;

+    private void getEagerBeansRepository() {
+       if( eagerBeansRepository == null ) {
+           eagerBeansRepository = BeanManager.INSTANCE.getReference(EagerBeansRepository.class);
+       }
+    }
+       
+
        // Actions --------------------------------------------------------------------------------------------------------

        public static void disable() {
@@ -65,6 +72,7 @@ public class EagerBeansWebListener implements HttpSessionListener, ServletReques
        @Override
        public void sessionCreated(HttpSessionEvent event) {
                if (!disabled) {
+                        getEagerBeansRepository();
                        eagerBeansRepository.instantiateSessionScoped();
                }
                else {
@@ -79,6 +87,7 @@ public class EagerBeansWebListener implements HttpSessionListener, ServletReques
                        String uri = getRequestRelativeURIWithoutPathParameters((HttpServletRequest) event.getServletRequest());

                        try {
+                               getEagerBeansRepository();
                                eagerBeansRepository.instantiateByRequestURI(uri);
                        }
                        catch (Exception e) {
@@ -97,4 +106,4 @@ public class EagerBeansWebListener implements HttpSessionListener, ServletReques
                // NOOP.
        }

-}
\ No newline at end of file
+}

(sorry for poor indenting, I am doing this headless through a poor DSL line using vi... Not the way I usually develop in java).

@BalusC
Member
BalusC commented May 27, 2015

Yes, I get that. I personally only prefer solutions over workarounds :) I'll see what @struberg has to say about that UnsatisfiedResolutionException.

@BalusC
Member
BalusC commented May 27, 2015

By the way, I just tried with MyFaces 2.2.8. I didn't got the IllegalStateException you got.

I compared the dependencies, I'm not using JPA+JTA+Deltaspike (and related dependencies such as jandex/javassist/antlr/xml) and I've version 4.2 of those two xbean dependencies. And, I tested on Tomcat 8.0.23 instead of 8.0.22.

@lpenet
lpenet commented May 27, 2015

ok, thanks for your report. I figured what happens in the meantime. As I put all jars in tomcat/lib, some beans get automatically discovered and initialized, even in application which do not use and do not set parameters for the stack.

So, this exception is raised for other, non JSF, webapps such as manager, examples and host-manager.

@lpenet
lpenet commented May 28, 2015

I just tested and confirm that everything looks ok with this last commit. Thanks a lot, Bauke !

@struberg

Hi folks!

I’m also working on some installers. They are part of our distribution in the future.

checkout latest owb from trunk

$> svn co https://svn.apache.org/repos/asf/openwebbeans/trunk/

then build

$> mvn clean install -Pbuild-dist

in
$> cd ./distribution/target
you find a zip file

unzip it
$>unzip openwebbeans-distribution-1.6.0-SNAPSHOT-binary.zip

then switch into it
$> cd openwebbeans-distribution-1.6.0-SNAPSHOT

here you find a few installers (you might probably need to chmod a+x *.sh)
$>./install_owb_tomcat7.sh /opt/apache/apache-tomcat-8.0.23/

the paremeter is your tomcat location.

Probably gonna provide the same + MyFaces tonight..

@lpenet
lpenet commented May 28, 2015

I took a look and it is clear to me that it will be a good help for newcomers. Is there a page/site where we can adequatly test and discuss this ?

@struberg
struberg commented Jun 1, 2015

Currently releasing OWB-1.6.0 which will contain those scripts in the binary dist bundle. Will write documentation for it once it is released.

@BalusC BalusC added the bug label Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment