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?
These are my listeners in web.xml:
<listener>
<listener-class>org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener</listener-class>
</listener>
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
This is how I'm starting my server:
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()
I got some help from Jesse McConnell at WebTide.
I needed to add the following file to my classpath: https://github.com/eclipse/jetty.project/blob/master/jetty-cdi/src/main/config/modules/cdi.mod
I also needed to add the jetty-cdi jar to my pom.