I am using CXF 2.6.3 distributed as part of ServiceMix 2.5 (camel-cxf
2.10.3). I am using the following class to send/receive binary attachment.
package com.thinkitsolution.hie.esb.util.ws;
import javax.activation.DataHandler;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlMimeType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "attachment", propOrder = {
"dataHandler",
"name"
})
public class Attachment {
protected String name;
@XmlMimeType("application/octet-stream")
protected DataHandler dataHandler=null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//@XmlMimeType("application/octet-stream")
//@javax.xml.bind.annotation.XmlTransient
public DataHandler getDataHandler() {
return dataHandler;
}
public void setDataHandler(DataHandler dataHandler) {
this.dataHandler = dataHandler;
}
}
I get the following exception when try to activate the bundle in ServiceMix
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:
1 c
ounts of IllegalAnnotationExceptions
javax.activation.DataHandler does not have a no-arg default constructor.
this problem is related to the following location:
at javax.activation.DataHandler
at protected javax.activation.DataHandler
com.thinkitsolution.hi
e.esb.util.ws.Attachment.dataHandler
at com.thinkitsolution.hie.esb.util.ws.Attachment
at public java.util.List
com.thinkitsolution.hie.esb.util.ws.Fax
Message.getAttachements()
at com.thinkitsolution.hie.esb.util.ws.FaxMessage
at private com.thinkitsolution.hie.esb.util.ws.FaxMessage
com.th
inkitsolution.hie.esb.util.ws.jaxws_asm.SendFax.arg0
at com.thinkitsolution.hie.esb.util.ws.jaxws_asm.SendFax
at
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Buil
der.check(IllegalAnnotationsException.java:91)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(J
AXBContextImpl.java:436)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBConte
xtImpl.java:277)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuild
er.build(JAXBContextImpl.java:1100)
at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFact
ory.java:143)
at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFact
ory.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:222)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:396)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
at
org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContext
Cache.java:279)
at
org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchema
s(JAXBContextCache.java:172)
at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBD
ataBinding.java:461)
at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:3
27)
... 34 more
It was working fine in ServiceMix (Fuse ESB 4.4.2) which used CXF 2.4.1.
Any help will be greatly appreciated.
--
View this message in context:
http://cxf.547215.n5.nabble.com/DataHandler-for-MTOM-JAXB-exception-tp5725076.html
Sent from the cxf-user mailing list archive at Nabble.com.