You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ryan Moquin <fr...@gmail.com> on 2007/09/21 20:06:00 UTC

Re: CXF 2.0.1 - CXF-99 - java.lang.ClassCastException: java.io.BufferedOutputStream

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 <fr...@gmail.com> 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 <fr...@gmail.com> 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();
>
>
>

Re: CXF 2.0.1 - CXF-99 - java.lang.ClassCastException: java.io.BufferedOutputStream

Posted by Ryan Moquin <fr...@gmail.com>.
Ah, I was curious to check everything out and build it since I haven't done
that with an open source project before, only stuff within companies I've
worked for, so just trying to understand how to do it. :)

I can just do a junit test, but then how would I go about patching what I
have if the fix works?  I would have to do a build anyhow for myself right?

On 9/21/07, Guillaume Nodet <gn...@gmail.com> wrote:
>
> Anyway, you'd have to checkout cxf trunk, apply the patch, build.
> Then checkout servicemix trunk, change the cxf version in the root pom
> to the cxf version you just built, compile ... and test.
>
> Well, i suppose it may be easier to create a junit test to reroduce
> the problem and test the fix.
>
> On 9/21/07, Ryan Moquin <fr...@gmail.com> wrote:
> > Should I patch the latest CXF in the source repository, build it and
> then
> > check out the latest servicemix and build that?
> >
> > Do I need to do anything to the service archives in the snapshot I
> > downloaded and deployed the other day?  I guess I'm not sure the proper
> way
> > to build and test, versionwise.
> >
> > On 9/21/07, Guillaume Nodet <gn...@gmail.com> wrote:
> > >
> > > 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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/
> > >
> >
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: CXF 2.0.1 - CXF-99 - java.lang.ClassCastException: java.io.BufferedOutputStream

Posted by Guillaume Nodet <gn...@gmail.com>.
Anyway, you'd have to checkout cxf trunk, apply the patch, build.
Then checkout servicemix trunk, change the cxf version in the root pom
to the cxf version you just built, compile ... and test.

Well, i suppose it may be easier to create a junit test to reroduce
the problem and test the fix.

On 9/21/07, Ryan Moquin <fr...@gmail.com> wrote:
> Should I patch the latest CXF in the source repository, build it and then
> check out the latest servicemix and build that?
>
> Do I need to do anything to the service archives in the snapshot I
> downloaded and deployed the other day?  I guess I'm not sure the proper way
> to build and test, versionwise.
>
> On 9/21/07, Guillaume Nodet <gn...@gmail.com> wrote:
> >
> > 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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/
> >
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: CXF 2.0.1 - CXF-99 - java.lang.ClassCastException: java.io.BufferedOutputStream

Posted by Ryan Moquin <fr...@gmail.com>.
Should I patch the latest CXF in the source repository, build it and then
check out the latest servicemix and build that?

Do I need to do anything to the service archives in the snapshot I
downloaded and deployed the other day?  I guess I'm not sure the proper way
to build and test, versionwise.

On 9/21/07, Guillaume Nodet <gn...@gmail.com> wrote:
>
> 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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/
>

Re: CXF 2.0.1 - CXF-99 - java.lang.ClassCastException: java.io.BufferedOutputStream

Posted by Guillaume Nodet <gn...@gmail.com>.
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 <fr...@gmail.com> 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 <fr...@gmail.com> 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 <fr...@gmail.com> 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/