Jetty Logo
Version: 9.2.2-SNAPSHOT
Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Weld

Weld Setup

Weld can be used to add support for CDI (Contexts and Dependency Injection) to Servlets, Listeners and Filters. It is easily configured with Jetty 9.

Weld Setup

The easiest way to configure weld is within the jetty distribution itself.

Filters and Servlets Only

At the moment, only filters and servlets are supported for CDI with Weld. ServletContextListeners can not be configured with CDI (until we sort out the proper solution to the issue).

  1. Create the directory $jetty.home/lib/weld.

  2. Download the weld-servlet artifact and place it into the newly created directory.

  3. Edit the start.ini file and add an OPTION line for weld near the end.

  4. Continue editting the start.ini file and uncomment the lines for jndi, annotations and plus.

  5. Ensure your WEB-INF/web.xml contains the following listeners.

That should be it so when you start up your jetty distribution with the webapp you should see the following output (providing your logging is the default configuration).


013-05-30 15:49:01.511:INFO:oejs.Server:main: jetty-9.0.3.v20130506
2013-05-30 15:49:01.564:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/jesse/Desktop/jetty-distribution-9.0.3.v20130506/webapps/] at interval 1
2013-05-30 15:49:01.764:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
May 30, 2013 3:49:01 PM org.jboss.weld.bootstrap.WeldBootstrap <clinit>
INFO: WELD-000900 2.0.0 (Final)
May 30, 2013 3:49:02 PM org.jboss.weld.bootstrap.WeldBootstrap startContainer
INFO: WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
May 30, 2013 3:49:02 PM org.jboss.weld.bootstrap.WeldBootstrap startContainer
WARNING: Legacy deployment metadata provided by the integrator. Certain functionality will not be available.
May 30, 2013 3:49:02 PM org.jboss.weld.environment.jetty.JettyPost72Container initialize
INFO: Jetty7 detected, JSR-299 injection will be available in Listeners, Servlets and Filters.
May 30, 2013 3:49:02 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARNING: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
May 30, 2013 3:49:02 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARNING: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
2013-05-30 15:49:02.919:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@40a49a3{/simple-web,file:/private/var/folders/br/kbs2g3753c54wmv4j31pnw5r0000gn/T/jetty-0.0.0.0-8080-simple-web.war-_simple-web-any-/webapp/,AVAILABLE}{/simple-web.war}
2013-05-30 15:49:02.940:INFO:oejs.ServerConnector:main: Started ServerConnector@430e0623{HTTP/1.1}{0.0.0.0:8080}

		

See an error or something missing? Contribute to this documentation at Github!(Generated: 2014-08-29T01:00:46-07:00)