[
https://issues.apache.org/jira/browse/CXF-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589124#action_12589124
]
Steve Ardis commented on CXF-1494:
----------------------------------
Works perfectly - thanks for responding so quickly on fixing this.
For others who may find this thread later, looking for some help, I want to
stress one of your comments above: "The new patch will support a case where a
JDK Proxy is created, but for the method like the one in the attached Test
class be invoked through JAX-RS, this method has to come as part of
implementing the interface, as one can't get non-interface methods from a JDK
Proxy."
This caused me a little grief this morning, as I couldn't figure out why it
still wasn't working, but trusted you guys knew what you were doing. So, I
kept re-reading your comments and trying various things.
To re-summarize for others, it is not enough to annotate your implementation
class with the "javax.ws.rs.*" annotations if you are using Spring and the
JdkDynamicAopProxy. Because the non-interface methods are not visible from the
JdkDynamicAopProxy, you'll have to also add the method to the interface your
bean implements. Its obvious once you understand why, but can be easily
overlooked when implementing - especially because the method I exposed on the
service implementation was just a REST helper that wrapped a call to another
method on the service with a more complex parameter.
Thanks again -
> Issue Using JAX-RS / REST When AOP Proxy In Place
> -------------------------------------------------
>
> Key: CXF-1494
> URL: https://issues.apache.org/jira/browse/CXF-1494
> Project: CXF
> Issue Type: Bug
> Components: REST
> Affects Versions: 2.1
> Reporter: Steve Ardis
> Assignee: Sergey Beryozkin
> Fix For: 2.1
>
> Attachments: beans.xml, cxf-1494-2.patch, cxf-1494.patch, Test.java
>
>
> 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").
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.