Skip to end of metadata
Go to start of metadata

For GateIn users using Tomcat which does as being a barebones JSP/Servlet container. You’d need to install a CDI implementation which does support working under Tomcat.

In this documentation, we will guide to install Weld - a CDI reference implementation, as Weld documentation is pretty clear and easy to install under Tomcat.

Install Weld in GateIn Tomcat

Perform the following steps:

1. Drop the weld-servlet.jar in Tomcat common library $CATALINA_BASE/lib.

This is an uber JAR of Weld itself, contains both API and Impl. At the time of writing, weld-servlet 1.1.8.Final version is being used.

2. Create /META-INF/context.xml file in webapp's web content with following content (or, if you already have one, add just the <Resource> to it):

This will register Weld's BeanManager factory in Tomcat's JNDI.

3. Add the following entries to webapp's /WEB-INF/web.xml:

The listener entry basically enables Weld in webapp. The resource entry basically tells webapp to use the BeanManager as available in JNDI.

Portlet CDI scopes

As you know, GateIn has provided two Portlet CDI scope annotations @PortletLifecycleScoped and @PortletRedisplayScoped which support the complex Portlet Lifecycle within CDI. BUT if you want to have them work under Tomcat, you need to add the following listener org.gatein.cdi.contexts.listeners.TomcatCDIServletListener to webapp's /WEB-INF/web.xml

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.