1 Reply Latest reply on Jan 28, 2015 3:53 AM by Martin Kouba

    CXF integration

    Krystian Panek Newbie

      Hi all!


      I am trying to use Weld on Apache Karaf 3.0.x.


      I OSGified an integration provided by Apache: https://github.com/apache/cxf/blob/master/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java 

      but it does not work actually.


      Maybe some of you can help with this problem: https://issues.apache.org/jira/browse/CXF-6221

      After connecting a debugger, it is some problem with caching or incompatibility. Instead of pure annotation class I can see 'com.sun.proxy'. Because of that 'isAnnotationPresent' invoked on BackedAnnotatedType returns false. CXF integration and my class annotated with 'ApplicationPath' are in separate bundles.


      Appreciate for any help.




      Going deeper, I find out that for some reason JAX-RS annotation equality not work here:


          public  T getAnnotation(Class annotationType) {
              for (Annotation annotation : getAnnotations()) {
                  if (annotation.annotationType().equals(annotationType)) {
                      return annotationType.cast(annotation);
              return null;

      annotation type => interface javax.ws.rs.ApplicationPath

      annotation.annotationType() => interface javax.ws.rs.ApplicationPath


      Same?! but does not work. Different class loaders? How to fix it?

      PS. I checked that annotationType.isAssignableFrom(annotationType) returns true.

        • 1. Re: CXF integration
          Martin Kouba Master

          Hi Krystian,

          this really looks like some ClassLoader problem. Try to find out  if there are more than one JAX-RS API artifacts on the classpath. I would start with maven-dependency-plugin, i.e. mvn dependency:tree. Note that shaded artifacts can contain those API classes as well.