TomEE 7 + Omnifaces 2.5.1 CDI Bean模块部署失败

时间:2016-12-22 15:45:19

标签: jsf tomee omnifaces tomee-7

我正在使用Apache Tomcat(TomEE)/8.0.29(7.0.0-M1)

从Omnifaces 2.4改为2.5 / 2.5.1后,我得到了这个例外。

**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

...

更新 它现在适用于2.5.1版,但我不知道为什么。

也许这个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>

我重新生成这个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 个答案:

答案 0 :(得分:0)

当您仔细阅读错误日志时,错误如下:

  

引起:java.lang.IncompatibleClassChangeError:   org.omnifaces.cdi.eager.EagerBeansRepository和   org.omnifaces.cdi.eager.EagerBeansRepository $ EagerBeans不同意   InnerClasses属性

实际上, bean-discovery-mode =“ALL”会打开存档中所有类的扫描。这称为“显式存档”。

省略beans.xml或设置 bean-discovery-mode =“ANNOTATED”,使归档成为隐式归档。在这种情况下,容器将扫描带有注释范围类型的bean。

但是,建议值“annotated”仅识别带注释的CDI托管bean。没有任何注释的Bean将被忽略。值全部表现在Java EE 6中:也可以识别没有任何注释的bean。