title: How to configure embedded Jetty with weld module
body: <p>I am embedding a Jetty 9.2 server in my JSF web app. It is supposed to be very easy to enable Weld in Jetty 9.1+ by enabling the Weld module, but I see no way to do that with the embedded server. Are there any examples of how to do this, and which classes are affected?</p>
  
  <p>These are my listeners in web.xml:</p>
  
  <pre><code>&lt;listener&gt;
    &lt;listener-class&gt;org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;listener&gt;
    &lt;listener-class&gt;org.jboss.weld.environment.servlet.Listener&lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>
  
  <p>This is how I'm starting my server:</p>
  
  <pre><code>    Server theServer = new Server();
      ServerConnector connector = new ServerConnector(theServer);
      connector.setHost(getHost());
      connector.setPort(getPort());
      connector.setIdleTimeout(getTimeout());
      theServer.addConnector(connector);
      WebAppContext webApp = new WebAppContext();
      webApp.setContextPath("/");
      File f = new File(getFileName());
      webApp.setWar(f.getAbsolutePath());
      webApp.setServer(theServer);
      theServer.setHandler(webApp);
      theServer.start();
      theServer.join()
  </code></pre>