[ 
https://issues.apache.org/jira/browse/CXF-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586957#action_12586957
 ] 

Steve Ardis commented on CXF-1494:
----------------------------------

Thanks for patching this so quickly.

After downloading the latest snapshot, my simple dumbed-down test project 
worked beautifully.  However, my "real" project is throwing the following 
exception:

2008-04-08 16:28:41.621::INFO:  Started [EMAIL PROTECTED]:8080
Apr 8, 2008 4:28:45 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor 
handleMessage
INFO: Found operation: getTestString
Apr 8, 2008 4:28:45 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: object is not an instance of declaring class 
while invoking public java.lang.String a.b.c.ServiceImpl.getTestString() with 
params [].
        at 
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:109)
        at 
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:101)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:79)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:52)
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
        at 
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
        at 
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
        at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)
        at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:113)
        at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
        at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:152)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
        at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
        at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
        at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
        at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.IllegalArgumentException: object is not an instance of 
declaring class
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:124)
        at 
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
        ... 31 more


I can post more of the specifics on the configuration of the bean 
"a.b.c.ServiceImpl" (I have changed it from the real name), but I was hoping 
you might be able to eyeball the exception and provide a diagnosis based on 
your understanding of the patch you just applied.  So, it appears the mapping 
is now being found (based on your patch), but for some reason it can't invoke 
the method due to the reference not being what it thought it would be.

Any help is greatly appreciated.

> 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: cxf-1494.patch
>
>
> 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.

Reply via email to