As Apache Tomcat
is only a Servlet container, there is no CDI implementation provided by default. This has both an upside and a downside to it. The upside is that we don't have to alter the default configuration and setup of Apache Tomcat in any way to use JBoss Weld with it. The downside is that all of our applications that utilize CDI need to bundle their own copy of JBoss Weld within WEB-INF/lib
of the WAR.
If we don't already have Apache Tomcat installed, download the latest release from http://tomcat.apache.org/download-70.cgi and extract the contents of the ZIP. We will refer to the location where we extracted Apache Tomcat as CATALINA_HOME
.
We have a separate Maven profile in our example application for Apache Tomcat that will package weld-servlet.jar
, along with a JSF implementation, into WEB-INF/lib
of the archive. The profile also includes web.xml
so that the servlet listener from...