I don't have the time right now to reproduce the problem, but I think
I've seen what happens. If you go beyond a threshold, the
CacheOutputStream will replace the current ByteArrayOutputStream by a
BufferedOutputStream writing to a file. So applying the following
patch should fix the problem:
Index:
src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
===================================================================
--- src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
(revision 577013)
+++ src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
(working copy)
@@ -19,8 +19,6 @@
package org.apache.cxf.transport.jbi;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -72,15 +70,12 @@
if (inMessage.getExchange().isOneWay()) {
return;
} else {
-
- ByteArrayOutputStream baos = (ByteArrayOutputStream)getOut();
- ByteArrayInputStream bais = new
ByteArrayInputStream(baos.toByteArray());
LOG.finest(new org.apache.cxf.common.i18n.Message(
"BUILDING.DOCUMENT", LOG).toString());
DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(true);
DocumentBuilder builder =
docBuilderFactory.newDocumentBuilder();
- Document doc = builder.parse(bais);
+ Document doc = builder.parse(getInputStream());
MessageExchange xchng = inMessage.get(MessageExchange.class);
LOG.fine(new org.apache.cxf.common.i18n.Message(
Could you raise a JIRA issue and try to setup a test case for that
please ? Or apply the patch, rebuild cxf, servicemix and see if it
solves your problem ...
On 9/21/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> http://issues.apache.org/jira/browse/CXF-99
>
> It looks like this problem was never fixed completely because when I get my
> exception I'm sending a large amount of data, but when I send a small
> amount, then CXF doesn't die out.
>
> Can anyone point me in the right direction towards diagnosing this? It
> doesn't appear CXF would end up with a BufferedOutputStream to have a
> ClassCastException with....
>
> This is with 2.0.1 BTW
>
> On 9/21/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> >
> > Sorry, I didn't finish that message, at the end is a line of code. This
> > is line 76 in JBIDestinationOutputStream where the exception occurs:
> >
> > ByteArrayOutputStream baos = (ByteArrayOutputStream)getOut( );
> >
> >
> > On 9/21/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> > >
> > > I'm testing my newly converted XFire to CXF services and so far I
> > > haven't gotten a single request to complete successfully. Currently when
> > > I
> > > make a request to one of my methods that simple returns a preconstructed
> > > JAXB object, I get the following exception. This used to work with XFire,
> > > so I'm assuming it's something internally with CXF. Is there any reason
> > > this might happen? Is it a jar dependency problem?
> > >
> > > Sep 21, 2007 12:00:29 PM
> > > org.apache.cxf.transport.jbi.JBIDestinationOutputStreamcommitOutputMessage
> > > SEVERE: error sending Out message
> > > java.lang.ClassCastException: java.io.BufferedOutputStream
> > > at
> > > org.apache.cxf.transport.jbi.JBIDestinationOutputStream.commitOutputMessage
> > > (JBIDestinationOutputStream.java:76
> > > )
> > > at
> > > org.apache.cxf.transport.jbi.JBIDestinationOutputStream.doClose(
> > > JBIDestinationOutputStream.java :62)
> > > at org.apache.cxf.io.CachedOutputStream.close(
> > > CachedOutputStream.java:119)
> > > at org.apache.cxf.transport.AbstractConduit.close(
> > > AbstractConduit.java:66)
> > > at
> > > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSender
> > > Interceptor.java:62)
> > > at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> > > PhaseInterceptorChain.java:207)
> > > at
> > > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(
> > > OutgoingChainInterceptor.java :73)
> > > at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> > > PhaseInterceptorChain.java:207)
> > > at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> > > ChainInitiationObserver.java:73)
> > > at org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(
> > > JBIDispatcherUtil.java:148)
> > > at org.apache.servicemix.cxfse.CxfSeEndpoint.process(
> > > CxfSeEndpoint.java:167)
> > > at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess (
> > > AsyncBaseLifeCycle.java:538)
> > >
> > > ByteArrayOutputStream baos = (ByteArrayOutputStream)getOut();
> >
> >
> >
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/