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

Issue Using JAX-RS / REST When AOP Proxy In Place

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.1
    • JAX-RS
    • None

    Description

      If your beans.xml contains the following entry:

      <jaxrs:server id="services" address="/">
      <jaxrs:serviceBeans>
      <ref bean="test" />
      </jaxrs:serviceBeans>
      </jaxrs:server>

      <bean id="test" class="test.rest.Test" />

      And you have a Spring AOP pointcut defined as:

      <aop:config>
      <aop:pointcut id="testOperations" expression="execution(* test.rest..(..))" />
      <aop:advisor advice-ref="transactionAdvice" pointcut-ref="testOperations" />
      </aop:config>

      no mapping to the test bean are mapped and method cannot be invoked - it fails with "No operation found for path: /test/string/"

      If you comment out the contents of <aop:config> everything works fine.

      This link describes the problem with JAX-WS and the same issue probably applies to JAX-RS:
      http://incubator.apache.org/cxf/faq.html#FAQ-WhenusingSpringAOPtoenablethingsliketransactionsandsecurity%252CthegeneratedWSDLisverymessedupwithwrongnamespaces%252Cpartnames%252Cetc...

      However, the solution provided in the link does not work due to differences in the APIs between JAX-WS and JAX-RS.

      I have a dumbed-down Maven project that I can zip up and provide if necessary.

      Is there a suggested way around this problem for JAX-RS?

      Is there a reason that, if the instance of the class that JAX-RS sees is a proxy object, that it can't get the underlying class information by drilling into the proxy object, thereby eliminating the necessity to define the serviceClass information (as in the JAX-WS "fix")? Ideally , I'd like to be able to do the following:

      <jaxrs:server id="services" address="/">
      <jaxrs:serviceBeans>
      <ref bean="test1" />
      <ref bean="test2" />
      <ref bean="test3" />
      </jaxrs:serviceBeans>
      </jaxrs:server>

      without having to define separate jaxrs server(s) (as in the JAX-WS "fix").

      Attachments

        1. cxf-1494-2.patch
          40 kB
          Sergey Beryozkin
        2. Test.java
          0.3 kB
          Steve Ardis
        3. beans.xml
          4 kB
          Steve Ardis
        4. cxf-1494.patch
          32 kB
          Sergey Beryozkin

        Issue Links

          Activity

            People

              sergey_beryozkin Sergey Beryozkin
              yarddog Steve Ardis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: