JSF 2.3 - Servlet 4 - JavaEE 8 and Tomcat9: Unable to find CDI BeanManager











up vote
0
down vote

favorite












I am trying to migrate from JSF 2.1 to 2.3/Servlet 4/ Tomcat 9 but I have some trouble whith CDI configuration.
I followed this guide from BalusC to enable CDI on Tomcat 9 (in my case) but I still get this exception when starting my app:



com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:243)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4641)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.faces.FacesException: Unable to find CDI BeanManager
at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714)
at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at org.jboss.weld.environment.servlet.jsf.WeldApplication.<init>(WeldApplication.java:72)
at org.jboss.weld.environment.servlet.jsf.WeldApplicationFactory.getApplication(WeldApplicationFactory.java:46)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:88)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:153)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:391)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:255)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:529)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354)
... 48 more


Note that before following the guide, I had the same exception but it was thrown from another class (com.sun.faces.el.ELUtils.java method tryAddCDIELResolver(FacesCompositeELResolver composite)) and after the guide it's thrown from com.sun.faces.application.ApplicationImpl.java method private boolean isJsf23().
My librairies version are:



    <icefaces-ace.version>3.2.0</icefaces-ace.version>
<javax.jms-api.version>2.0.1</javax.jms-api.version>
<el-api.version>2.2</el-api.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<jstl.version>1.2</jstl.version>
<javax.faces-api.version>2.3</javax.faces-api.version><!--JSF API-->
<javax.faces.version>2.3.8</javax.faces.version> <!--Mojarra-->
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<javax.servlet.jsp.jstl-api.version>1.2.2</javax.servlet.jsp.jstl-api.version>
<javaee-web-api.version>8.0</javaee-web-api.version>
<weld-servlet-shaded.version>3.0.5.Final</weld-servlet-shaded.version>


Could someone tell me what am I doing wrong?
Thanks a lot.



EDIT



The piece of code which trying to find the BeanManager is this one:



 public static BeanManager getCdiBeanManager(FacesContext facesContext) {
BeanManager result = null;

if (facesContext != null && facesContext.getAttributes().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getAttributes().get(RIConstants.CDI_BEAN_MANAGER);
} else if (facesContext != null && facesContext.getExternalContext().getApplicationMap().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getExternalContext().getApplicationMap().get(RIConstants.CDI_BEAN_MANAGER);
} else {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/BeanManager");
}
catch (NamingException ne) {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/env/BeanManager");
}
catch (NamingException ne2) {
}
}

if (result == null && facesContext != null) {
Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
result = (BeanManager) applicationMap.get("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
}

if (result != null && facesContext != null) {
facesContext.getAttributes().put(RIConstants.CDI_BEAN_MANAGER, result);
facesContext.getExternalContext().getApplicationMap().put(RIConstants.CDI_BEAN_MANAGER, result);
}
}

return result;
}


I added some breakpoints to check the result' and it is reallynullbut thefacesContext` isn't.










share|improve this question
























  • Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
    – BalusC
    Nov 22 at 14:59












  • @BalusC I added the provided scope to EL/Servlet dependencies.
    – akuma8
    Nov 22 at 15:12










  • @BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
    – akuma8
    Nov 22 at 16:40










  • Suggestion: use TomEE... saves you a lot of manual configuration.
    – Kukeltje
    Nov 22 at 17:45










  • @akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
    – Selaron
    Nov 22 at 20:32















up vote
0
down vote

favorite












I am trying to migrate from JSF 2.1 to 2.3/Servlet 4/ Tomcat 9 but I have some trouble whith CDI configuration.
I followed this guide from BalusC to enable CDI on Tomcat 9 (in my case) but I still get this exception when starting my app:



com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:243)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4641)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.faces.FacesException: Unable to find CDI BeanManager
at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714)
at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at org.jboss.weld.environment.servlet.jsf.WeldApplication.<init>(WeldApplication.java:72)
at org.jboss.weld.environment.servlet.jsf.WeldApplicationFactory.getApplication(WeldApplicationFactory.java:46)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:88)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:153)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:391)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:255)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:529)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354)
... 48 more


Note that before following the guide, I had the same exception but it was thrown from another class (com.sun.faces.el.ELUtils.java method tryAddCDIELResolver(FacesCompositeELResolver composite)) and after the guide it's thrown from com.sun.faces.application.ApplicationImpl.java method private boolean isJsf23().
My librairies version are:



    <icefaces-ace.version>3.2.0</icefaces-ace.version>
<javax.jms-api.version>2.0.1</javax.jms-api.version>
<el-api.version>2.2</el-api.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<jstl.version>1.2</jstl.version>
<javax.faces-api.version>2.3</javax.faces-api.version><!--JSF API-->
<javax.faces.version>2.3.8</javax.faces.version> <!--Mojarra-->
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<javax.servlet.jsp.jstl-api.version>1.2.2</javax.servlet.jsp.jstl-api.version>
<javaee-web-api.version>8.0</javaee-web-api.version>
<weld-servlet-shaded.version>3.0.5.Final</weld-servlet-shaded.version>


Could someone tell me what am I doing wrong?
Thanks a lot.



EDIT



The piece of code which trying to find the BeanManager is this one:



 public static BeanManager getCdiBeanManager(FacesContext facesContext) {
BeanManager result = null;

if (facesContext != null && facesContext.getAttributes().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getAttributes().get(RIConstants.CDI_BEAN_MANAGER);
} else if (facesContext != null && facesContext.getExternalContext().getApplicationMap().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getExternalContext().getApplicationMap().get(RIConstants.CDI_BEAN_MANAGER);
} else {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/BeanManager");
}
catch (NamingException ne) {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/env/BeanManager");
}
catch (NamingException ne2) {
}
}

if (result == null && facesContext != null) {
Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
result = (BeanManager) applicationMap.get("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
}

if (result != null && facesContext != null) {
facesContext.getAttributes().put(RIConstants.CDI_BEAN_MANAGER, result);
facesContext.getExternalContext().getApplicationMap().put(RIConstants.CDI_BEAN_MANAGER, result);
}
}

return result;
}


I added some breakpoints to check the result' and it is reallynullbut thefacesContext` isn't.










share|improve this question
























  • Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
    – BalusC
    Nov 22 at 14:59












  • @BalusC I added the provided scope to EL/Servlet dependencies.
    – akuma8
    Nov 22 at 15:12










  • @BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
    – akuma8
    Nov 22 at 16:40










  • Suggestion: use TomEE... saves you a lot of manual configuration.
    – Kukeltje
    Nov 22 at 17:45










  • @akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
    – Selaron
    Nov 22 at 20:32













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to migrate from JSF 2.1 to 2.3/Servlet 4/ Tomcat 9 but I have some trouble whith CDI configuration.
I followed this guide from BalusC to enable CDI on Tomcat 9 (in my case) but I still get this exception when starting my app:



com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:243)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4641)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.faces.FacesException: Unable to find CDI BeanManager
at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714)
at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at org.jboss.weld.environment.servlet.jsf.WeldApplication.<init>(WeldApplication.java:72)
at org.jboss.weld.environment.servlet.jsf.WeldApplicationFactory.getApplication(WeldApplicationFactory.java:46)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:88)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:153)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:391)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:255)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:529)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354)
... 48 more


Note that before following the guide, I had the same exception but it was thrown from another class (com.sun.faces.el.ELUtils.java method tryAddCDIELResolver(FacesCompositeELResolver composite)) and after the guide it's thrown from com.sun.faces.application.ApplicationImpl.java method private boolean isJsf23().
My librairies version are:



    <icefaces-ace.version>3.2.0</icefaces-ace.version>
<javax.jms-api.version>2.0.1</javax.jms-api.version>
<el-api.version>2.2</el-api.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<jstl.version>1.2</jstl.version>
<javax.faces-api.version>2.3</javax.faces-api.version><!--JSF API-->
<javax.faces.version>2.3.8</javax.faces.version> <!--Mojarra-->
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<javax.servlet.jsp.jstl-api.version>1.2.2</javax.servlet.jsp.jstl-api.version>
<javaee-web-api.version>8.0</javaee-web-api.version>
<weld-servlet-shaded.version>3.0.5.Final</weld-servlet-shaded.version>


Could someone tell me what am I doing wrong?
Thanks a lot.



EDIT



The piece of code which trying to find the BeanManager is this one:



 public static BeanManager getCdiBeanManager(FacesContext facesContext) {
BeanManager result = null;

if (facesContext != null && facesContext.getAttributes().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getAttributes().get(RIConstants.CDI_BEAN_MANAGER);
} else if (facesContext != null && facesContext.getExternalContext().getApplicationMap().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getExternalContext().getApplicationMap().get(RIConstants.CDI_BEAN_MANAGER);
} else {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/BeanManager");
}
catch (NamingException ne) {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/env/BeanManager");
}
catch (NamingException ne2) {
}
}

if (result == null && facesContext != null) {
Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
result = (BeanManager) applicationMap.get("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
}

if (result != null && facesContext != null) {
facesContext.getAttributes().put(RIConstants.CDI_BEAN_MANAGER, result);
facesContext.getExternalContext().getApplicationMap().put(RIConstants.CDI_BEAN_MANAGER, result);
}
}

return result;
}


I added some breakpoints to check the result' and it is reallynullbut thefacesContext` isn't.










share|improve this question















I am trying to migrate from JSF 2.1 to 2.3/Servlet 4/ Tomcat 9 but I have some trouble whith CDI configuration.
I followed this guide from BalusC to enable CDI on Tomcat 9 (in my case) but I still get this exception when starting my app:



com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:243)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4641)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.faces.FacesException: Unable to find CDI BeanManager
at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714)
at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at javax.faces.application.ApplicationWrapper.addELResolver(ApplicationWrapper.java:611)
at org.jboss.weld.environment.servlet.jsf.WeldApplication.<init>(WeldApplication.java:72)
at org.jboss.weld.environment.servlet.jsf.WeldApplicationFactory.getApplication(WeldApplicationFactory.java:46)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:88)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:153)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:391)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:255)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:529)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354)
... 48 more


Note that before following the guide, I had the same exception but it was thrown from another class (com.sun.faces.el.ELUtils.java method tryAddCDIELResolver(FacesCompositeELResolver composite)) and after the guide it's thrown from com.sun.faces.application.ApplicationImpl.java method private boolean isJsf23().
My librairies version are:



    <icefaces-ace.version>3.2.0</icefaces-ace.version>
<javax.jms-api.version>2.0.1</javax.jms-api.version>
<el-api.version>2.2</el-api.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<jstl.version>1.2</jstl.version>
<javax.faces-api.version>2.3</javax.faces-api.version><!--JSF API-->
<javax.faces.version>2.3.8</javax.faces.version> <!--Mojarra-->
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<javax.servlet.jsp.jstl-api.version>1.2.2</javax.servlet.jsp.jstl-api.version>
<javaee-web-api.version>8.0</javaee-web-api.version>
<weld-servlet-shaded.version>3.0.5.Final</weld-servlet-shaded.version>


Could someone tell me what am I doing wrong?
Thanks a lot.



EDIT



The piece of code which trying to find the BeanManager is this one:



 public static BeanManager getCdiBeanManager(FacesContext facesContext) {
BeanManager result = null;

if (facesContext != null && facesContext.getAttributes().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getAttributes().get(RIConstants.CDI_BEAN_MANAGER);
} else if (facesContext != null && facesContext.getExternalContext().getApplicationMap().containsKey(RIConstants.CDI_BEAN_MANAGER)) {
result = (BeanManager) facesContext.getExternalContext().getApplicationMap().get(RIConstants.CDI_BEAN_MANAGER);
} else {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/BeanManager");
}
catch (NamingException ne) {
try {
InitialContext initialContext = new InitialContext();
result = (BeanManager) initialContext.lookup("java:comp/env/BeanManager");
}
catch (NamingException ne2) {
}
}

if (result == null && facesContext != null) {
Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
result = (BeanManager) applicationMap.get("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
}

if (result != null && facesContext != null) {
facesContext.getAttributes().put(RIConstants.CDI_BEAN_MANAGER, result);
facesContext.getExternalContext().getApplicationMap().put(RIConstants.CDI_BEAN_MANAGER, result);
}
}

return result;
}


I added some breakpoints to check the result' and it is reallynullbut thefacesContext` isn't.







java tomcat jsf cdi jsf-2.3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 11:56

























asked Nov 22 at 14:54









akuma8

836819




836819












  • Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
    – BalusC
    Nov 22 at 14:59












  • @BalusC I added the provided scope to EL/Servlet dependencies.
    – akuma8
    Nov 22 at 15:12










  • @BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
    – akuma8
    Nov 22 at 16:40










  • Suggestion: use TomEE... saves you a lot of manual configuration.
    – Kukeltje
    Nov 22 at 17:45










  • @akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
    – Selaron
    Nov 22 at 20:32


















  • Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
    – BalusC
    Nov 22 at 14:59












  • @BalusC I added the provided scope to EL/Servlet dependencies.
    – akuma8
    Nov 22 at 15:12










  • @BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
    – akuma8
    Nov 22 at 16:40










  • Suggestion: use TomEE... saves you a lot of manual configuration.
    – Kukeltje
    Nov 22 at 17:45










  • @akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
    – Selaron
    Nov 22 at 20:32
















Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
– BalusC
Nov 22 at 14:59






Explicit mention of EL / Servlet / JSP API versions in your pom.xml is slightly scary. Normally you never need to worry about them because Tomcat already ships this stuff out the box. So having them explicitly specified implies that you're manually bundling them along with the webapp and thus inducing duplicate library conflicts when deployed. Related/possibledupe: stackoverflow.com/q/8081234
– BalusC
Nov 22 at 14:59














@BalusC I added the provided scope to EL/Servlet dependencies.
– akuma8
Nov 22 at 15:12




@BalusC I added the provided scope to EL/Servlet dependencies.
– akuma8
Nov 22 at 15:12












@BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
– akuma8
Nov 22 at 16:40




@BalusC i downgraded the faces-config.xml version to 2.2, the problem goes away but I think it's not the good solution.
– akuma8
Nov 22 at 16:40












Suggestion: use TomEE... saves you a lot of manual configuration.
– Kukeltje
Nov 22 at 17:45




Suggestion: use TomEE... saves you a lot of manual configuration.
– Kukeltje
Nov 22 at 17:45












@akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
– Selaron
Nov 22 at 20:32




@akuma8 are you sure you did not miss out step (3) "Create a (empty) /WEB-INF/beans.xml file"? Is your /META-INF/context.xml correctly deployed and you made sure it is actually processed by Tomcat?
– Selaron
Nov 22 at 20:32

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433559%2fjsf-2-3-servlet-4-javaee-8-and-tomcat9-unable-to-find-cdi-beanmanager%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433559%2fjsf-2-3-servlet-4-javaee-8-and-tomcat9-unable-to-find-cdi-beanmanager%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

How to ignore python UserWarning in pytest?

Alexandru Averescu