You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by deepika vadapalli <de...@gmail.com> on 2009/10/27 19:06:49 UTC

CXF calling custom interceptor twice

Hello,

I create a CXF client and add my custom interceptors to it.
When I call the service, in some scenarios when request is long, I see that
my interceptor is called twice.
For the first time, I recieve response , handle it and log it.
Since its automatically goes into second time, I get Stream is closed
exception.


Can you help me out.

Re: CXF calling custom interceptor twice

Posted by deepika vadapalli <de...@gmail.com>.
Dan,

Thank you so much for prompt response.
Here is the interceptor chain.
*first time:*
Chain org.apache.cxf.phase.PhaseInterceptorChain@9ebf46. Current flow:
  receive [SELoggingInInterceptor, AttachmentInInterceptor]
  post-stream [StaxInInterceptor]
  read [ReadHeadersInterceptor, SoapActionInInterceptor]
  pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
LogicalHandlerInInterceptor]
  post-protocol [CheckFaultInterceptor]
  unmarshal [URIMappingInterceptor, DocLiteralInInterceptor,
SoapHeaderInterceptor]
  post-logical [WrapperClassInInterceptor]
  pre-invoke [SwAInInterceptor, HolderInInterceptor]

*Second time:*
* *Chain org.apache.cxf.phase.PhaseInterceptorChain@da213a. Current flow:
    receive [SELoggingInInterceptor, AttachmentInInterceptor]
    post-stream [StaxInInterceptor]
    read [ReadHeadersInterceptor, SoapActionInInterceptor]
    pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
LogicalHandlerInInterceptor]
    post-protocol [CheckFaultInterceptor]
    unmarshal [URIMappingInterceptor, DocLiteralInInterceptor,
SoapHeaderInterceptor]
    post-logical [WrapperClassInInterceptor]
  pre-invoke [SwAInInterceptor, HolderInInterceptor]
But second time, I get Stream is closed exception when I try to copy
InputStream to OutPutStream.

Can you please help me out as this app need to go live in 2 momths.
If you want I can send you my custom interceptor code.

Most important thing is it works with same service call . It only fails if
my messga eis very big.
This is my observance.
So, same service call I get response if message size is reasonable.
Please help me out.

Thread.dump was same for both cases.
 15:43:54,673 ERROR [STDERR] java.lang.Exception: Stack trace
  15:43:54,673 ERROR [STDERR]  at java.lang.Thread.dumpStack(Unknown Source)
  15:43:54,673 ERROR [STDERR]  at
com.wdw.se.interceptor.SELoggingInInterceptor.logging(SELoggingInInterceptor.java:76)
  15:43:54,673 ERROR [STDERR]  at
com.wdw.se.interceptor.SELoggingInInterceptor.handleMessage(SELoggingInInterceptor.java:69)
  15:43:54,673 ERROR [STDERR]  at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
  15:43:54,673 ERROR [STDERR]  at
org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2131)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2010)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1935)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.io.CachedOutputStream.maybeDeleteTempFile(CachedOutputStream.java:446)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:179)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
  15:43:54,689 ERROR [STDERR]  at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:626)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
  15:43:54,705 ERROR [STDERR]  at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
  15:43:54,705 ERROR [STDERR]  at $Proxy129.book(Unknown Source)
  15:43:54,705 ERROR [STDERR]  at
com.wdw.se.reservation.service.SEShowDiningService.book(SEShowDiningService.java:118)
  15:43:54,705 ERROR [STDERR]  at
com.wdw.se.reservation.controller.ReservationController.bookReservation(ReservationController.java:905)
  15:43:54,705 ERROR [STDERR]  at
com.wdw.se.utility.BookUtility.book(BookUtility.java:658)
  15:43:54,705 ERROR [STDERR]  at
com.wdw.se.shop.viewobject.ShoppingCart.book(ShoppingCart.java:669)
  15:43:54,705 ERROR [STDERR]  at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  15:43:54,705 ERROR [STDERR]  at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  15:43:54,705 ERROR [STDERR]  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  15:43:54,705 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Unknown
Source)
  15:43:54,705 ERROR [STDERR]  at
org.apache.el.parser.AstValue.invoke(AstValue.java:131)
  15:43:54,705 ERROR [STDERR]  at
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
  15:43:54,705 ERROR [STDERR]  at
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
  15:43:54,705 ERROR [STDERR]  at
com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
  15:43:54,705 ERROR [STDERR]  at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
  15:43:54,705 ERROR [STDERR]  at
javax.faces.component.UICommand.broadcast(UICommand.java:383)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:291)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:461)
  15:43:54,705 ERROR [STDERR]  at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
  15:43:54,705 ERROR [STDERR]  at
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
  15:43:54,705 ERROR [STDERR]  at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
  15:43:54,705 ERROR [STDERR]  at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  15:43:54,705 ERROR [STDERR]  at
com.disney.corp.keystone.web.filter.LoginFilter.doFilter(Unknown Source)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  15:43:54,705 ERROR [STDERR]  at
com.disney.corp.keystone.web.filter.SiteMinderLoginFilter.doFilter(Unknown
Source)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
  15:43:54,705 ERROR [STDERR]  at
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  15:43:54,705 ERROR [STDERR]  at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  15:43:54,705 ERROR [STDERR]  at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  15:43:54,705 ERROR [STDERR]  at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  15:43:54,705 ERROR [STDERR]  at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  15:43:54,705 ERROR [STDERR]  at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
  15:43:54,705 ERROR [STDERR]  at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  15:43:54,705 ERROR [STDERR]  at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  15:43:54,705 ERROR [STDERR]  at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
15:43:54,705 ERROR [STDERR]  at java.lang.Thread.run(Unknown Source)

On Tue, Oct 27, 2009 at 3:15 PM, Daniel Kulp <dk...@apache.org> wrote:

>  On Tue October 27 2009 2:06:49 pm deepika vadapalli wrote:
> > Hello,
> >
> > I create a CXF client and add my custom interceptors to it.
> > When I call the service, in some scenarios when request is long, I see
> that
> > my interceptor is called twice.
> > For the first time, I recieve response , handle it and log it.
> > Since its automatically goes into second time, I get Stream is closed
> > exception.
>
> It definitely shouldn't be calling it twice.  Not sure how that would
> occur.
> Is it relatively easy to reproduce?    If so, it would be good if you
> could:
>
> 1) In the interceptor, call System.out.println(message.getChain()) to print
> the chain at that point.   I'd be curious if the interceptor is on the
> chain
> twice.
>
> 2) Thread.dumpStack()  as I'd like the complete stack of both times it's
> run
> to see if a retry is kicking in or something or possibly on the fault chain
> instead of the in chain.
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: CXF calling custom interceptor twice

Posted by Daniel Kulp <dk...@apache.org>.
On Tue October 27 2009 2:06:49 pm deepika vadapalli wrote:
> Hello,
> 
> I create a CXF client and add my custom interceptors to it.
> When I call the service, in some scenarios when request is long, I see that
> my interceptor is called twice.
> For the first time, I recieve response , handle it and log it.
> Since its automatically goes into second time, I get Stream is closed
> exception.

It definitely shouldn't be calling it twice.  Not sure how that would occur.   
Is it relatively easy to reproduce?    If so, it would be good if you could:

1) In the interceptor, call System.out.println(message.getChain()) to print 
the chain at that point.   I'd be curious if the interceptor is on the chain 
twice.

2) Thread.dumpStack()  as I'd like the complete stack of both times it's run 
to see if a retry is kicking in or something or possibly on the fault chain 
instead of the in chain.


-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog