Closed fuschl closed 9 years ago
Hi Fuschl,
Thanks a lot for bringing up this topic. The not embedded (or WAR-based deployment) requires only web.xml with org.jboss.weld.environment.servlet.Listener and org.apache.cxf.cdi.CXFCdiServlet to be declared, for example:
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>org.apache.cxf.cdi.CXFCdiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
</web-app>
With that, CXF 3 / JAX-RS 2 / CDI 1.1 / Tomcat 7/8 do work together very well :-) Please let me know if it answers your question. I will be happy to share sample project with you if you need one.
Thank you.
Best Regards, Andriy Redko
Hi Andriy,
a sample project would be highly appreciated!
I gave it a try, but got error messages like
"Can't find the the request for http://
Thanks for your helping! Fuschl
Hi Fuschl,
I have pushed the branch for you: https://github.com/reta/jax-rs-2.0-cdi/tree/tomcat-war This is ready to be deployed WAR, I have tested it with Tomcat v8.0. It does not really need 3.1 servlet spec and uses 3.0 instead (src/main/webapp/WEB-INF/web.xml).
Please give it a try. Thank you!
Best Regards, Andriy Redko
Works! Thanks a lot
Hi Reta, I did not find any example anywhere how to get CXF 3 / JAX-RS 2 / CDI 1.1 / Tomcat 7/8 (not embedded) working together? I am not sure if is supported at all because an example was left out and this combination was not mentioned on http://cxf.apache.org/docs/using-cxf-and-cdi-11-jsr-346.html.
Thanks, Fuschl