Hello,
I have issue using cxf (v 3.0.5) with camel(v2.15.2) in POJO mode that
duplicate attachment during serialization and client gets empty InputStream
from DataHandler.
Camel route look similar to
from("cxf:bean:attachmentServerPublished").to("cxf:bean:attachmentServerSubscribed")
both cxf endpoints have set mtom-enabled="true"
Returned object contains DataHandler data. Both endpoints implement same
interface.
During serialization of response, attachments collection
(LazyAttachmentCollection) is duplicated. Unfortunately during serialization
only one attachment serialize data, second attachment data is serialized as
empty.
I am not sure if reference id to binary data is wrong, or same
LazyDataSource is read twice by 2 different thread and it's unpredictable
which of attachment contains data.
I debugged code and found place where attachment is added second time to
collection
at
org.apache.cxf.attachment.LazyAttachmentCollection.add(LazyAttachmentCollection.java:132)
at
org.apache.cxf.attachment.LazyAttachmentCollection.add(LazyAttachmentCollection.java:35)
at
org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addMtomAttachment(JAXBAttachmentMarshaller.java:59)
at
com.sun.xml.bind.v2.runtime.output.MTOMXmlOutput.text(MTOMXmlOutput.java:125)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:356)
at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$PcdataImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:191)
at
com.sun.xml.bind.v2.runtime.MimeTypedTransducer.writeLeafElement(MimeTypedTransducer.java:96)
at
com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:254)
at
com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:130)
at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:360)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
at
com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:158)
at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:360)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:155)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:130)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:332)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:339)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:75)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:178)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:615)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:241)
at
org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:237)
But I was not able to create test case that reproduce it.
Can someone advice me how deal with this issue.
regards
Stefan
--
View this message in context:
http://cxf.547215.n5.nabble.com/Attachment-duplication-tp5757697.html
Sent from the cxf-user mailing list archive at Nabble.com.