You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by sprhegde <sp...@gmail.com> on 2010/12/04 16:56:27 UTC

org.apache.cxf.interceptor.Fault: Could not write attachments

Hi All.

I am trying to run the sample mtom web service application present in the
sample folder(apache-cxf-2.3.0\samples\mtom)

I started the server successfully but when I run the client using ant
command(ant client), I am getting below error. Please help me 
--------------------------------------------------------------------------------------------------
Buildfile: build.xml

maybe.generate.code:

compile:

build:

client:
     [java]
URL=file:/G:/Iona/fuse-services-framework-2.1.3.3/samples/mtom/wsdl/
mtom_xop.wsdl
     [java] Filesize of me.bmp image is: 163166

     [java] Starting MTOM Test using basic byte array:
     [java] --Sending the me.bmp image to server
     [java] --Sending a name value of Sam
     [java] Dec 4, 2010 9:14:29 PM
org.apache.cxf.phase.PhaseInterceptorChain do
DefaultLogging
     [java] WARNING: Interceptor for
{http://cxf.apache.org/mime}TestMtomService
#{http://cxf.apache.org/mime}testByteArray has thrown exception, unwinding
now
     [java] org.apache.cxf.interceptor.Fault: Could not write attachments.
     [java]     at
org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:98)
     [java]     at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
nterceptorChain.java:247)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
)
     [java]     at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
va:73)
     [java]     at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:124)
     [java]     at $Proxy29.testByteArray(Unknown Source)
     [java]     at demo.mtom.client.Client.main(Client.java:94)
     [java] Caused by: java.io.IOException: Error writing request body to
server

     [java]     at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
ream.checkError(HttpURLConnection.java:2285)
     [java]     at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
ream.write(HttpURLConnection.java:2268)
     [java]     at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractW
rappedOutputStream.java:46)
     [java]     at
org.apache.cxf.io.AbstractThresholdOutputStream.write(Abstrac
tThresholdOutputStream.java:69)
     [java]     at javax.activation.DataHandler.writeTo(DataHandler.java:87)
     [java]     at
org.apache.cxf.attachment.AttachmentSerializer.writeAttachmen
ts(AttachmentSerializer.java:234)
     [java]     at
org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
     [java]     ... 8 more
     [java] Exception in thread "main" javax.xml.ws.WebServiceException:
Could n
ot write attachments.
     [java]     at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:135)
     [java]     at $Proxy29.testByteArray(Unknown Source)
     [java]     at demo.mtom.client.Client.main(Client.java:94)
     [java] Caused by: java.io.IOException: Error writing request body to
server

     [java]     at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
ream.checkError(HttpURLConnection.java:2285)
     [java]     at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
ream.write(HttpURLConnection.java:2268)
     [java]     at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractW
rappedOutputStream.java:46)
     [java]     at
org.apache.cxf.io.AbstractThresholdOutputStream.write(Abstrac
tThresholdOutputStream.java:69)
     [java]     at javax.activation.DataHandler.writeTo(DataHandler.java:87)
     [java]     at
org.apache.cxf.attachment.AttachmentSerializer.writeAttachmen
ts(AttachmentSerializer.java:234)
     [java]     at
org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
     [java]     at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
nterceptorChain.java:247)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
)
     [java]     at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
va:73)
     [java]     at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:124)
     [java]     ... 2 more
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 7 seconds
G:\Iona\fuse-services-framework-2.1.3.3\samples\mtom>















































-- 
View this message in context: http://cxf.547215.n5.nabble.com/org-apache-cxf-interceptor-Fault-Could-not-write-attachments-tp3292246p3292246.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: org.apache.cxf.interceptor.Fault: Could not write attachments

Posted by Daniel Kulp <dk...@apache.org>.

I just tried this with the latest 2.3.1 kits with java 6 and it worked fine.   
Is there any error on the server side?

2.1.3 is ancient (and not supported).   Definitely try a newer version.

Dan



On Saturday 04 December 2010 10:56:27 am sprhegde wrote:
> Hi All.
> 
> I am trying to run the sample mtom web service application present in the
> sample folder(apache-cxf-2.3.0\samples\mtom)
> 
> I started the server successfully but when I run the client using ant
> command(ant client), I am getting below error. Please help me
> ---------------------------------------------------------------------------
> ----------------------- Buildfile: build.xml
> 
> maybe.generate.code:
> 
> compile:
> 
> build:
> 
> client:
>      [java]
> URL=file:/G:/Iona/fuse-services-framework-2.1.3.3/samples/mtom/wsdl/
> mtom_xop.wsdl
>      [java] Filesize of me.bmp image is: 163166
> 
>      [java] Starting MTOM Test using basic byte array:
>      [java] --Sending the me.bmp image to server
>      [java] --Sending a name value of Sam
>      [java] Dec 4, 2010 9:14:29 PM
> org.apache.cxf.phase.PhaseInterceptorChain do
> DefaultLogging
>      [java] WARNING: Interceptor for
> {http://cxf.apache.org/mime}TestMtomService
> #{http://cxf.apache.org/mime}testByteArray has thrown exception, unwinding
> now
>      [java] org.apache.cxf.interceptor.Fault: Could not write attachments.
>      [java]     at
> org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
> tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:98)
>      [java]     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:247)
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
> )
>      [java]     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
> va:73)
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:124)
>      [java]     at $Proxy29.testByteArray(Unknown Source)
>      [java]     at demo.mtom.client.Client.main(Client.java:94)
>      [java] Caused by: java.io.IOException: Error writing request body to
> server
> 
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
> ream.checkError(HttpURLConnection.java:2285)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
> ream.write(HttpURLConnection.java:2268)
>      [java]     at
> org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractW
> rappedOutputStream.java:46)
>      [java]     at
> org.apache.cxf.io.AbstractThresholdOutputStream.write(Abstrac
> tThresholdOutputStream.java:69)
>      [java]     at
> javax.activation.DataHandler.writeTo(DataHandler.java:87) [java]     at
> org.apache.cxf.attachment.AttachmentSerializer.writeAttachmen
> ts(AttachmentSerializer.java:234)
>      [java]     at
> org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
> tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
>      [java]     ... 8 more
>      [java] Exception in thread "main" javax.xml.ws.WebServiceException:
> Could n
> ot write attachments.
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:135)
>      [java]     at $Proxy29.testByteArray(Unknown Source)
>      [java]     at demo.mtom.client.Client.main(Client.java:94)
>      [java] Caused by: java.io.IOException: Error writing request body to
> server
> 
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
> ream.checkError(HttpURLConnection.java:2285)
>      [java]     at
> sun.net.www.protocol.http.HttpURLConnection$StreamingOutputSt
> ream.write(HttpURLConnection.java:2268)
>      [java]     at
> org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractW
> rappedOutputStream.java:46)
>      [java]     at
> org.apache.cxf.io.AbstractThresholdOutputStream.write(Abstrac
> tThresholdOutputStream.java:69)
>      [java]     at
> javax.activation.DataHandler.writeTo(DataHandler.java:87) [java]     at
> org.apache.cxf.attachment.AttachmentSerializer.writeAttachmen
> ts(AttachmentSerializer.java:234)
>      [java]     at
> org.apache.cxf.interceptor.AttachmentOutInterceptor$Attachmen
> tOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
>      [java]     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:247)
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313
> )
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265
> )
>      [java]     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
> va:73)
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:124)
>      [java]     ... 2 more
>      [java] Java Result: 1
> 
> BUILD SUCCESSFUL
> Total time: 7 seconds
> G:\Iona\fuse-services-framework-2.1.3.3\samples\mtom>

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