You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jaybytez <ja...@yahoo.com> on 2012/08/01 23:38:20 UTC

MTOM failing when attaching a tiff, but works with pdf

We are using CXF 2.4.5, WLS 11, Spring 3.0.5, JAXB 2, etc.

Our Message Model has fields that are defined as :

@XmlElement(name = "Data", namespace = "##default")
@XmlMimeType("application/octet-stream")
private DataHandler data;

We create the DataHandler as such:

import org.apache.commons.codec.binary.Base64;

DataHandler dataHandler = new
DataHandler(Base64.decodeBase64(docContentString), docAttribute.getValue()); 
//Content String and MimeType

When we send a web service response with a DataHandler that holds the stream
for a pdf, we don't have a problem sending this response across the wire
(and the serialization of this).

But when we send a TIFF stream, we get the following error.

Is there something simple we could be missing that would cause this
difference between the two file types?

2012-07-11 09:32:11,156 [[ACTIVE] ExecuteThread: '39' for queue:
'weblogic.kernel.Default (self-tuning)'] DEBUG
com.foo.service.dms.DocMgmtBusinessServiceImpl - getDocument: Returning
documentResponse for doc ID: 817964
2012-07-11 09:32:11,296 [[ACTIVE] ExecuteThread: '39' for queue:
'weblogic.kernel.Default (self-tuning)'] WARN
org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
{http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has thrown
exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not write attachments.
        at
org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:98)
~[cxf-full.jar:2.4.5]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
[cxf-full.jar:2.4.5]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
[javax.servlet_1.0.0.0_2-5.jar:2.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
[cxf-full.jar:2.4.5]
        at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
[weblogic.jar:10.3.5.0]
        at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
[com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
        at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
[com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
        at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
[weblogic.jar:10.3.5.0]
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
[com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
[com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
Caused by: java.io.IOException: Attachment type not spported class [B
        at
org.apache.cxf.attachment.ImageDataContentHandler.writeTo(ImageDataContentHandler.java:85)
~[cxf-full.jar:2.4.5]
        at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
~[na:1.6.0_29]
        at javax.activation.DataHandler.writeTo(DataHandler.java:302)
~[na:1.6.0_29]
        at
org.apache.cxf.attachment.AttachmentSerializer.writeAttachments(AttachmentSerializer.java:234)
~[cxf-full.jar:2.4.5]
        at
org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
~[cxf-full.jar:2.4.5]
        ... 25 common frames omitted
2012-07-11 09:32:11,302 [[ACTIVE] ExecuteThread: '39' for queue:
'weblogic.kernel.Default (self-tuning)'] WARN
org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
{http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has thrown
exception, unwinding now
java.util.EmptyStackException: null
        at weblogic.utils.collections.Stack.pop(Stack.java:82)
~[com.bea.core.utils_1.9.0.1.jar:1.9.0.1]
        at
weblogic.xml.stax.XMLWriterBase.writeEndElement(XMLWriterBase.java:491)
~[com.bea.core.weblogic.stax_1.9.0.0.jar:1.9.0.0]
        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:279)
~[cxf-full.jar:2.4.5]
        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:270)
~[cxf-full.jar:2.4.5]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:105)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
[cxf-full.jar:2.4.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
[cxf-full.jar:2.4.5]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
[javax.servlet_1.0.0.0_2-5.jar:2.5]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
[cxf-full.jar:2.4.5]
        at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
[weblogic.jar:10.3.5.0]
        at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
[com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
        at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
[com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
        at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
[weblogic.jar:10.3.5.0]
        at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
[weblogic.jar:10.3.5.0]
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
[com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
[com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]




--
View this message in context: http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but-works-with-pdf-tp5711907.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: MTOM failing when attaching a tiff, but works with pdf

Posted by jaybytez <ja...@yahoo.com>.
Awesome, the change to ByteArrayDataSource removed the NPE.

The funny thing is after we created a DataHandler, the following test was
being done:

if (dataHandler.getContent() == null) {
}

In a JUnit, this worked, but in the deployment of the war this works for PDF
and not TIFF.

I switched it to test the data source existence using if
(dataHandler.getDataSource() == null) and this worked for both TIFF and PDF.

It wasn't a TIFF issue really, it was the ByteArrayDataSource and then the
dataHandler.getContent() test was coming back as null so we didn't add the
DataHandler to the response...that's why it wasn't there.



--
View this message in context: http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but-works-with-pdf-tp5711907p5712321.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: MTOM failing when attaching a tiff, but works with pdf

Posted by jaybytez <ja...@yahoo.com>.
Thanks for the help, I am still trying to get this to work.

With using the ByteArrayDataSource, we are not getting the NPE any more, but
the DataHandler doesn't get serialized, it acts as though it is empty.

One quick question, because I got more information about this code.  We are
proxying a third party service we use that sends us the pdf/tiff as base64
encoded already.  

Is it worth decoding it only to include into a DataHandler and use it with
MTOM, or should we just leave it as base64 encoded String and send it
through to our client that way (ignoring MTOM)?  That's why the sample code
has use doing a Base64.decode to convert the base64 String into a byte
array.



--
View this message in context: http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but-works-with-pdf-tp5711907p5712318.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: MTOM failing when attaching a tiff, but works with pdf

Posted by Daniel Kulp <dk...@apache.org>.
Yea, definitely use the ByteArrayDataSource like Glen's example does.   If 
you don't provide a specific DataSource, the activation framework tries to 
find something that can handle it.  Since it's already a byte[], it's best 
to just leave it as a byte[] like that and not convert it to anything.

That said, the CXF ImageDataContentHandler could be updated to handle this 
better.

Dan
   

On Thursday, August 02, 2012 03:06:52 PM Glen Mazza wrote:
> Perhaps the source code I have for returning PDFs :
> http://www.jroller.com/gmazza/entry/using_mtom_and_apache_fop might work
> for you with TIFFs.  (Look at the very bottom of that article for the
> simplest way to send a TIFF and see if that works.)
> 
> Is there anything in the Wireshark output
> (http://www.jroller.com/gmazza/entry/soap_calls_over_wireshark) you can
> see that might be causing the CXF hiccup?  You may wish to deploy on
> Tomcat, possibly also using Metro (1st link above works with either CXF
> or Metro) to try to ascertain whether the problem is with CXF, Weblogic,
> the TIFFs you're producing, or Java itself.
> 
> HTH,
> Glen
> 
> On 08/01/2012 05:38 PM, jaybytez wrote:
> > We are using CXF 2.4.5, WLS 11, Spring 3.0.5, JAXB 2, etc.
> > 
> > Our Message Model has fields that are defined as :
> > 
> > @XmlElement(name = "Data", namespace = "##default")
> > @XmlMimeType("application/octet-stream")
> > private DataHandler data;
> > 
> > We create the DataHandler as such:
> > 
> > import org.apache.commons.codec.binary.Base64;
> > 
> > DataHandler dataHandler = new
> > DataHandler(Base64.decodeBase64(docContentString),
> > docAttribute.getValue()); //Content String and MimeType
> > 
> > When we send a web service response with a DataHandler that holds the
> > stream for a pdf, we don't have a problem sending this response across
> > the wire (and the serialization of this).
> > 
> > But when we send a TIFF stream, we get the following error.
> > 
> > Is there something simple we could be missing that would cause this
> > difference between the two file types?
> > 
> > 2012-07-11 09:32:11,156 [[ACTIVE] ExecuteThread: '39' for queue:
> > 'weblogic.kernel.Default (self-tuning)'] DEBUG
> > com.foo.service.dms.DocMgmtBusinessServiceImpl - getDocument: Returning
> > documentResponse for doc ID: 817964
> > 2012-07-11 09:32:11,296 [[ACTIVE] ExecuteThread: '39' for queue:
> > 'weblogic.kernel.Default (self-tuning)'] WARN
> > org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
> > {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
> > dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has
> > thrown exception, unwinding now
> > org.apache.cxf.interceptor.Fault: Could not write attachments.
> > 
> >          at
> > 
> > org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingI
> > nterceptor.handleMessage(AttachmentOutInterceptor.java:98)
> > ~[cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:263) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Outgoi
> > ngChainInterceptor.java:77) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:263) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati
> > onObserver.java:121) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTT
> > PDestination.java:207) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser
> > vletController.java:209) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl
> > ler.java:191) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpring
> > Servlet.java:114) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstr
> > actHTTPServlet.java:185) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTP
> > Servlet.java:108) [cxf-full.jar:2.4.5]
> > 
> >          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> > 
> > [javax.servlet_1.0.0.0_2-5.jar:2.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT
> > PServlet.java:164) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St
> > ubSecurityHelper.java:227) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
> > elper.java:125) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3
> > 00) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1
> > 83) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.w
> > rapRun(WebAppServletContext.java:3717) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
> > un(WebAppServletContext.java:3681) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
> > bject.java:321)
> > [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
> > 
> >          at
> > 
> > weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120
> > )
> > [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
> > letContext.java:2277) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
> > ext.java:2183) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java
> > :1454) [weblogic.jar:10.3.5.0]
> > 
> >          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
> > 
> > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
> > 
> >          at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
> > 
> > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
> > Caused by: java.io.IOException: Attachment type not spported class [B
> > 
> >          at
> > 
> > org.apache.cxf.attachment.ImageDataContentHandler.writeTo(ImageDataConte
> > ntHandler.java:85) ~[cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
> > ~[na:1.6.0_29]
> > 
> >          at javax.activation.DataHandler.writeTo(DataHandler.java:302)
> > 
> > ~[na:1.6.0_29]
> > 
> >          at
> > 
> > org.apache.cxf.attachment.AttachmentSerializer.writeAttachments(Attachme
> > ntSerializer.java:234) ~[cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingI
> > nterceptor.handleMessage(AttachmentOutInterceptor.java:96)
> > ~[cxf-full.jar:2.4.5]
> > 
> >          ... 25 common frames omitted
> > 
> > 2012-07-11 09:32:11,302 [[ACTIVE] ExecuteThread: '39' for queue:
> > 'weblogic.kernel.Default (self-tuning)'] WARN
> > org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
> > {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
> > dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has
> > thrown exception, unwinding now
> > java.util.EmptyStackException: null
> > 
> >          at weblogic.utils.collections.Stack.pop(Stack.java:82)
> > 
> > ~[com.bea.core.utils_1.9.0.1.jar:1.9.0.1]
> > 
> >          at
> > 
> > weblogic.xml.stax.XMLWriterBase.writeEndElement(XMLWriterBase.java:491)
> > ~[com.bea.core.weblogic.stax_1.9.0.0.jar:1.9.0.0]
> > 
> >          at
> > 
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEnding
> > Interceptor.handleMessage(SoapOutInterceptor.java:279)
> > ~[cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEnding
> > Interceptor.handleMessage(SoapOutInterceptor.java:270)
> > ~[cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:263) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage
> > (AbstractFaultChainInitiatorObserver.java:105) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:323) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Outgoi
> > ngChainInterceptor.java:77) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:263) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati
> > onObserver.java:121) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTT
> > PDestination.java:207) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser
> > vletController.java:209) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl
> > ler.java:191) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpring
> > Servlet.java:114) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstr
> > actHTTPServlet.java:185) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTP
> > Servlet.java:108) [cxf-full.jar:2.4.5]
> > 
> >          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> > 
> > [javax.servlet_1.0.0.0_2-5.jar:2.5]
> > 
> >          at
> > 
> > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT
> > PServlet.java:164) [cxf-full.jar:2.4.5]
> > 
> >          at
> > 
> > weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St
> > ubSecurityHelper.java:227) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
> > elper.java:125) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3
> > 00) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1
> > 83) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.w
> > rapRun(WebAppServletContext.java:3717) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
> > un(WebAppServletContext.java:3681) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
> > bject.java:321)
> > [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
> > 
> >          at
> > 
> > weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120
> > )
> > [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
> > letContext.java:2277) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
> > ext.java:2183) [weblogic.jar:10.3.5.0]
> > 
> >          at
> > 
> > weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java
> > :1454) [weblogic.jar:10.3.5.0]
> > 
> >          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
> > 
> > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
> > 
> >          at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
> > 
> > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
> > 
> > 
> > 
> > 
> > --
> > View this message in context:
> > http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but-
> > works-with-pdf-tp5711907.html Sent from the cxf-user mailing list
> > archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: MTOM failing when attaching a tiff, but works with pdf

Posted by Glen Mazza <gm...@talend.com>.
Perhaps the source code I have for returning PDFs : 
http://www.jroller.com/gmazza/entry/using_mtom_and_apache_fop might work 
for you with TIFFs.  (Look at the very bottom of that article for the 
simplest way to send a TIFF and see if that works.)

Is there anything in the Wireshark output 
(http://www.jroller.com/gmazza/entry/soap_calls_over_wireshark) you can 
see that might be causing the CXF hiccup?  You may wish to deploy on 
Tomcat, possibly also using Metro (1st link above works with either CXF 
or Metro) to try to ascertain whether the problem is with CXF, Weblogic, 
the TIFFs you're producing, or Java itself.

HTH,
Glen

On 08/01/2012 05:38 PM, jaybytez wrote:
> We are using CXF 2.4.5, WLS 11, Spring 3.0.5, JAXB 2, etc.
>
> Our Message Model has fields that are defined as :
>
> @XmlElement(name = "Data", namespace = "##default")
> @XmlMimeType("application/octet-stream")
> private DataHandler data;
>
> We create the DataHandler as such:
>
> import org.apache.commons.codec.binary.Base64;
>
> DataHandler dataHandler = new
> DataHandler(Base64.decodeBase64(docContentString), docAttribute.getValue());
> //Content String and MimeType
>
> When we send a web service response with a DataHandler that holds the stream
> for a pdf, we don't have a problem sending this response across the wire
> (and the serialization of this).
>
> But when we send a TIFF stream, we get the following error.
>
> Is there something simple we could be missing that would cause this
> difference between the two file types?
>
> 2012-07-11 09:32:11,156 [[ACTIVE] ExecuteThread: '39' for queue:
> 'weblogic.kernel.Default (self-tuning)'] DEBUG
> com.foo.service.dms.DocMgmtBusinessServiceImpl - getDocument: Returning
> documentResponse for doc ID: 817964
> 2012-07-11 09:32:11,296 [[ACTIVE] ExecuteThread: '39' for queue:
> 'weblogic.kernel.Default (self-tuning)'] WARN
> org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
> {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
> dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has thrown
> exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not write attachments.
>          at
> org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:98)
> ~[cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
> [cxf-full.jar:2.4.5]
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> [javax.servlet_1.0.0.0_2-5.jar:2.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
> [cxf-full.jar:2.4.5]
>          at
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
>          at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
> [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
>          at
> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
> [weblogic.jar:10.3.5.0]
>          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
> [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
>          at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
> [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
> Caused by: java.io.IOException: Attachment type not spported class [B
>          at
> org.apache.cxf.attachment.ImageDataContentHandler.writeTo(ImageDataContentHandler.java:85)
> ~[cxf-full.jar:2.4.5]
>          at
> javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
> ~[na:1.6.0_29]
>          at javax.activation.DataHandler.writeTo(DataHandler.java:302)
> ~[na:1.6.0_29]
>          at
> org.apache.cxf.attachment.AttachmentSerializer.writeAttachments(AttachmentSerializer.java:234)
> ~[cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96)
> ~[cxf-full.jar:2.4.5]
>          ... 25 common frames omitted
> 2012-07-11 09:32:11,302 [[ACTIVE] ExecuteThread: '39' for queue:
> 'weblogic.kernel.Default (self-tuning)'] WARN
> org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
> {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn
> dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has thrown
> exception, unwinding now
> java.util.EmptyStackException: null
>          at weblogic.utils.collections.Stack.pop(Stack.java:82)
> ~[com.bea.core.utils_1.9.0.1.jar:1.9.0.1]
>          at
> weblogic.xml.stax.XMLWriterBase.writeEndElement(XMLWriterBase.java:491)
> ~[com.bea.core.weblogic.stax_1.9.0.0.jar:1.9.0.0]
>          at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:279)
> ~[cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:270)
> ~[cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:105)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
> [cxf-full.jar:2.4.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
> [cxf-full.jar:2.4.5]
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> [javax.servlet_1.0.0.0_2-5.jar:2.5]
>          at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
> [cxf-full.jar:2.4.5]
>          at
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
>          at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
> [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
>          at
> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
> [weblogic.jar:10.3.5.0]
>          at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
> [weblogic.jar:10.3.5.0]
>          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
> [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
>          at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
> [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0]
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but-works-with-pdf-tp5711907.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza