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

Returning AOP/CGLIB proxy as Subresource throws Fault "object is not an instance of declaring class"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2
    • 2.2.3, 2.3
    • JAX-RS
    • None

    Description

      Test case:

      RootResource.java :

      public class RootResource

      { @Path("subresource") public abstract SubResource getSubResource(); }

      In spring-beans.xml:

      <bean class="RootResource">
      <lookup-method name="getSubResource" bean="subResource" />
      </bean>
      <bean id="subResource" class="SubResource" />

      Then the AOP proxied SubResource:

      @RolesAllowed(

      {"ROLE_USER"}

      ) // activate Spring Security global method annotations
      public class SubResource {
      }

      Getting the /subresource will throw exception:

      org.apache.cxf.interceptor.Fault: object is not an instance of declaring class while invoking

      Tried this workaround but not working: Make SubResource implement an interface then on RootResource.getSubResource() use interface as the return type, not the class

      Attachments

        Issue Links

          Activity

            People

              sergey_beryozkin Sergey Beryozkin
              ceefour Hendy Irawan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: