java.lang.NoClassDefFoundError: Ljavax/enterprise/inject/spi/BeanManager;

java.lang.NoClassDefFoundError: Ljavax/enterprise/inject/spi/BeanManager;

删除Struts2-cdi-plug 的插件的jar包,以及struts2插件的jar包。

question:

When I build this test application and deploy to Tomcat 7, page loading attempt gives
java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
I tried adding dependency for cdi-api. ClassNotFoundException goes away but then I get javax.naming.NameNotFoundException: Name [BeanManager] is not bound in this Context. Unable to find [BeanManager].
I have the same problem with my own Vaadin 7 application using cdiutils. Any help would be appreciated.

ask:

Tomcat doesn't provide a CDI container per se. Surely you can include one manually but it's easier just to deploy to a Java EE compatible web app server such as TomEE: http://tomee.apache.org/apache-tomee.html

原文地址:https://www.cnblogs.com/Hackerman/p/7801123.html