cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ced_benoit <ced.ben...@gmail.com>
Subject Re: [JAX-RS] catch exception from jaxws
Date Fri, 28 Jun 2013 15:28:45 GMT
Hi Sergey,

No, it's not like this "catch(test.exceptions.TestException e)"  because
the test.exceptions.TestException come from another Dynamic web Project
which is a webservice SOAP! In my project i have created Web Service Client
with wsdl of the webservice soap and then in my project I have
TestException_Exception that I would like to catch the exception when I
call the method of webservice WS-SOAP from my webservice JAX-RS, But I
don't know which is wrong to catch correctly this exception.

thank you for your help

Cedric




2013/6/24 Sergey Beryozkin [via CXF] <
ml-node+s547215n5729736h88@n5.nabble.com>

> Hi
>
> Looks like
>
> "catch (TestException_Exception e)" is not executed when a soap client
> completes its call,
>
>
> should it be
>
> "catch(test.exceptions.TestException e)" ?
>
> Sergey
>
> On 24/06/13 16:13, ced_benoit wrote:
>
> > Hi, I have a simple webservice jax-rs which call an another webservice
> SOAP
> > and when the WebService launch an exception, I wanted to catch it and
> change
> > the status like this:...@Path("TestRest")public class TestRest {...
> @GET
> > @Path("/findId/{id}") @Produces("application/json") public Response
> > findId(@PathParam("id") Integer pID) { { ...       try       {     ...
> > }       catch (TestException_Exception e)       {     throw new
> > WebApplicationException(421);       } ... }...}But when the exception
> > executed, I have this error: in:WARNING: Application
> > {http://test.service.server/}CustomerRest has thrown exception,
> unwinding
> > noworg.apache.cxf.interceptor.Fault: test.exceptions.TestException:
> > Parameter testID less than 0 at
> >
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
>
> > at
> >
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
>
> > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:194) at
> > org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:102) at
> >
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
>
> > at
> >
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
>
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>
> > at
> >
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>
> > at
> >
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
>
> > at
> >
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
>
> > at
> >
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)
>
> > at
> >
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
>
> > at
> >
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)
>
> > at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)
>
> > at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168)
>
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)
>
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>
> > at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>
> > at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>
> > at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
> at
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>
> > at
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>
> > at
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>
> > at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
> > at
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>
> > at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>
> > at
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>
> > at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>
> > at
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>
> > at java.lang.Thread.run(Thread.java:722)Caused by:
> > javax.xml.ws.soap.SOAPFaultException: test.exceptions.TestException:
> > Parameter testID less than 0 at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:155)
> at
> > com.sun.proxy.$Proxy98.findById(Unknown Source) at
> >
> ch.hegarc.abrasyf.server.service.cust.CustomerRest.findById(CustomerRest.java:56)
>
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> > at java.lang.reflect.Method.invoke(Method.java:601) at
> >
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
>
> > at
> >
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
>
> > ... 32 moreCaused by: org.apache.cxf.binding.soap.SoapFault:
> > test.exceptions.TestException: Parameter testID less than 0 at
> >
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
>
> > at
> >
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
>
> > at
> >
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)
>
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>
> > at
> >
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:114)
>
> > at
> >
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
>
> > at
> >
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
>
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>
> > at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800) at
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1592)
>
> > at
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1490)
>
> > at
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1309)
>
> > at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622)
> at
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>
> > at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319) at
> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
> ...
> > 40 moreBut when I test the webservice soap, it works well! But here, it
> > seems that the exception comes before the service webservice JAXRS
> continues
> > the execution?Has someone has an idea about this excepton?Thank you for
> your
> > help!Cedric
> >
> >
> >
> > --
> > View this message in context:
> http://cxf.547215.n5.nabble.com/JAX-RS-catch-exception-from-jaxws-tp5729727.html
> > Sent from the cxf-dev mailing list archive at Nabble.com.
> >
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://cxf.547215.n5.nabble.com/JAX-RS-catch-exception-from-jaxws-tp5729727p5729736.html
>  To unsubscribe from [JAX-RS] catch exception from jaxws, click here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729727&code=Y2VkLmJlbm9pdEBnbWFpbC5jb218NTcyOTcyN3wxMDYyOTEyMjQw>
> .
> NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-catch-exception-from-jaxws-tp5729727p5730092.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message