[
https://issues.apache.org/jira/browse/CXF-6221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14358763#comment-14358763
]
Andriy Redko commented on CXF-6221:
-----------------------------------
Ok, [~ciapunek], I have two solutions for you. For both of them, you need
web.xml in src/main/webapp
{code:xml}
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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>/*</url-pattern>
</servlet-mapping>
</web-app>
{code}
Next, you have to include _wab directive into your bundle manifest:
{code:xml}
<Web-ContextPath>/cxf</Web-ContextPath>
<_wab>src/main/webapp</_wab>
{code}
Now, if you would like to use /cxf as a context path, you have to disable CXF
servlet registration by adding org.apache.cxf.osgi.http.transport.disable=true
to Karaf's system.properties file. However, it is not really necessary if you
could use different context path, f.e.
{code:xml}
<Web-ContextPath>/cdi</Web-ContextPath>
<_wab>src/main/webapp</_wab>
{code}
With that, @RequestScoped JAX-RS resources are working just fine. Please let me
know if it works for you.
Thanks.
> CDI integration extension does not detect annotations on Karaf
> --------------------------------------------------------------
>
> Key: CXF-6221
> URL: https://issues.apache.org/jira/browse/CXF-6221
> Project: CXF
> Issue Type: Bug
> Components: Integration, JAX-RS
> Reporter: Krystian Panek
> Assignee: Andriy Redko
> Labels: cdi, extension, integration, karaf
> Attachments: hydra.tar.gz, screenshot-1.png
>
>
> I am trying to use portable extension to get working CDI 1.2 and CXF 3.0.2 on
> Apache Karaf. I wrapped it into OSGi bundle. I installed to my container also:
> * weld 2.1.1
> * pax-cdi-1.2
> * pax-cdi-1.2-web
> * pax-cdi-web-weld
> My JAXRS resources are not found by extension because some line from class
> **JAXRSCdiResourceExtension** returns false even annotated element contains
> proper annotation but as a proxy (see attachment image / screenshot from
> debugger).
> {code}
> if (event.getAnnotated().isAnnotationPresent(ApplicationPath.class)) {
> {code}
> It would be nice, to tell me how to get it working. I also tested CDI-1.1.
> Same situation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)