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

Unable to invoke default interface methods in proxy-based clients

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.2.7
    • 3.2.8, 3.3.0
    • JAX-RS
    • None
    • 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

              andymc Andrew J McMurry
              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