Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7922

Unable to invoke default interface methods in proxy-based clients

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.7
    • Fix Version/s: 3.2.8, 3.3.0
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When invoking a default method on an interface used as a MicroProfile Rest Client interface (and presumably the JAX-RS proxy-based client), I see the following exception:

      javax.ws.rs.ProcessingException: Method org.apache.cxf.microprofile.client.mock.MyClient.myDefaultMethod is not a valid resource method
      {{ at org.apache.cxf.microprofile.client.CxfTypeSafeClientBuilderTest.testCanInvokeDefaultInterfaceMethods(CxfTypeSafeClientBuilderTest.java:172)}}

       

      Invoking default interface methods from a dynamic proxy's InvocationHandler is outlined in this article:

      https://rmannibucau.wordpress.com/2014/03/27/java-8-default-interface-methods-and-jdk-dynamic-proxies/

       

      This type of operation becomes critical when combining the MicroProfile Rest Client with MP Fault Tolerance annotations like this:

      public interface MyClient {
          @GET
          @Fallback(fallbackMethod="useFallback")
          String tryActualRemoteRequest();
      }}{{    default String useFallback() {
              return "useful default value";
      {{    }}}
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andymc Andrew J McMurry
                Reporter:
                andymc Andrew J McMurry
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m