TomEE 7 + Omnifaces 2.5.1 CDI Beans module deployment failed

2.1k views Asked by At

I am using Apache Tomcat (TomEE)/8.0.29 (7.0.0-M1)

After Changing from Omnifaces 2.4 to 2.5/2.5.1 I got this Exception.

**SERVERE - CDI Beans module deployment failed**
org.apache.webbeans.exception.WebBeansConfigurationException: Error while sending SystemEvent to a CDI Extension! org.apache.webbeans.portable.events.generics.GProcessAnnotatedType@1525641d
    at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:701)
    at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:485)
    at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:459)
    at org.apache.webbeans.util.WebBeansUtil.fireProcessAnnotatedTypeEvent(WebBeansUtil.java:978)
    at org.apache.webbeans.config.BeansDeployer.annotatedTypesFromClassPath(BeansDeployer.java:929)
    at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:225)
    at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:202)
    at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:180)
    at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:894)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:694)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1214)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1075)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
    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.tomee.catalina.TomcatWebAppBuilder.deployWar(TomcatWebAppBuilder.java:631)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:578)
    at org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy(TomcatWebappDeployer.java:46)
    at org.apache.openejb.assembler.DeployerEjb.deploy(DeployerEjb.java:180)
    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.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.security.internal.InternalSecurityInterceptor.invoke(InternalSecurityInterceptor.java:35)
    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.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
    at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
    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.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.core.singleton.SingletonContainer._invoke(SingletonContainer.java:256)
    at org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:212)
    at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:370)
    at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:181)
    at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:350)
    at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:240)
    at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:104)
    at org.apache.openejb.server.httpd.ServerServlet.service(ServerServlet.java:58)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.reflect.InvocationTargetException
    at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:318)
    at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:676)
    ... 73 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:347)
    at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:82)
    at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:312)
    ... 74 more
Caused by: java.lang.IncompatibleClassChangeError: org.omnifaces.cdi.eager.EagerBeansRepository and org.omnifaces.cdi.eager.EagerBeansRepository$EagerBeans disagree on InnerClasses attribute
    at java.lang.Class.getDeclaringClass0(Native Method)
    at java.lang.Class.getDeclaringClass(Class.java:1235)
    at java.lang.Class.getEnclosingClass(Class.java:1277)
    at java.lang.Class.getCanonicalName(Class.java:1392)
    at org.apache.bval.jsr.JsrMetaBeanFactory.buildMetaBean(JsrMetaBeanFactory.java:104)
    at org.apache.bval.MetaBeanBuilder.buildForClass(MetaBeanBuilder.java:130)
    at org.apache.bval.MetaBeanManager.findForClass(MetaBeanManager.java:110)
    at org.apache.bval.jsr.ClassValidator.getConstraintsForClass(ClassValidator.java:263)
    at org.apache.bval.cdi.BValExtension.processAnnotatedType(BValExtension.java:172)
    ... 80 more

...

Update: It works now with version 2.5.1 but i have no idea why.

Maybe this beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>

I regenerate to this beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans
        xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                      http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
        bean-discovery-mode="all">
</beans>
1

There are 1 answers

0
bilelovitch On

When you read your error log carefully, the error is as follows :

Caused by: java.lang.IncompatibleClassChangeError: org.omnifaces.cdi.eager.EagerBeansRepository and org.omnifaces.cdi.eager.EagerBeansRepository$EagerBeans disagree on InnerClasses attribute

As a practical matter, bean-discovery-mode="ALL" turns on scanning of all classes in an archive. This is called an "explicit archive".

Omitting beans.xml, or setting bean-discovery-mode="ANNOTATED", makes the archive an implicit archive. In this case, the container will scan for beans with annotated scope types.

However, the suggested value "annotated" only recognizes annotated CDI managed beans. Beans without any annotation are ignored. The value all behaves like in Java EE 6: also beans without any annotations are recognized.