You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Krystian Panek (JIRA)" <ji...@apache.org> on 2015/03/01 20:47:04 UTC

[jira] [Commented] (CXF-6221) CDI integration extension does not detect annotations on Karaf

    [ https://issues.apache.org/jira/browse/CXF-6221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14342415#comment-14342415 ] 

Krystian Panek commented on CXF-6221:
-------------------------------------

I also checked @Provider support. Seems to work but I have a question.
I wrote a global exception handler:
{code}
@Provider
public class GlobalExceptionMapper implements ExceptionMapper<Exception> {
    public Response toResponse(Exception exception) {
         // ...
    }
{code}

Assume that I have a resource with:
{code}
    @GET
    @Produces("text/html")
    @Path("/dashboard")
    public String getDashboard() throws ResourceException {
        if (true) {
            throw new IllegalArgumentException("Test!"); // this exception is not catched by exceptionmapper
        }

        myService.doSomeStuff(); // but exception thrown in some deeper place is catched
{code}

I suppose it is related with some interceptor (http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-MappingexceptionsthrownfromCXFinterceptors). "add org.apache.cxf.jaxrs.interceptor.JAXRSOutExceptionMapperInterceptor to the list of out interceptors." I am not sure if it is actual solution for me case (because this class is now deprecated?). 

To sum up, how to catch all exceptions properly and setup interceptors configuration using integration extension? ;)

> 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)