Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15635

"java.lang.NoSuchMethodException" thrown from org.apache.cxf.common.util.ReflectionInvokationHandler.invoke() on karaf due to loading multiple CodeWriter instances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • fuse-7.9-GA
    • fuse-7.8-GA
    • CXF
    • None
    • False
    • False
    • % %
    • +
    • Undefined
    • Fuse Standalone
      • start karaf (fuse 7.8)
      • feature:install camel-cxf
      • deploy the bundle (reproducer project is attached on this ticket)
      • check fuse.log

      org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:376) throws java.lang.reflect.UndeclaredThrowableException

      Caused by: java.lang.NoSuchMethodException: com.sun.codemodel.internal.JCodeModel.build(java.lang.Object)
      at java.lang.Class.getMethod(Class.java:1786) ~[?:1.8.0_275]
      at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:84) ~[?:?]
      at com.sun.proxy.$Proxy108.build(Unknown Source) ~[?:?]
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:373) ~[?:?]
      ... 50 more
      

      With Fuse 7.7 or older versions, it works fine.
      The behavior was changed even cxf uses the same source code between Fuse 7.7 and Fuse 7.8:

      part of org.apache.cxf.common.util.ReflectionInvokationHandler.invoke()

              } catch (NoSuchMethodException e) {
                  for (Method m2 : targetClass.getMethods()) {
                      if (m2.getName().equals(method.getName())
                          && m2.getParameterTypes().length == method.getParameterTypes().length) {
                          boolean found = true;
                          for (int x = 0; x < m2.getParameterTypes().length; x++) {
                              if (args[x] != null
                                  && !m2.getParameterTypes()[x].isInstance(args[x])) {   //*** Please focus on this part!!!
                                  found = false;
                              }
                          }
                          if (found) {
                              ReflectionUtil.setAccessible(m2);
                              return wrapReturn(wr, m2.invoke(target, args));
                          }
                      }
                  }
                  throw e;
              }
      
      • With Fuse 7.8, "!m2.getParameterTypes()[x].isInstance(args[x])" ends up with "true", so could not go into the "wrapReturn()" code block, then throw e.
      • With Fuse 7.7, "!m2.getParameterTypes()[x].isInstance(args[x])" ends up with "false", so could go into the "wrapReturn()" code block.

            ggrzybek Grzegorz Grzybek
            rhn-support-hfuruich Hisao Furuichi
            Federico Mariani Federico Mariani
            Tomas Veskrna, Viliam Kasala
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: