当前位置: 动力学知识库 > 问答 > 编程问答 >

JBoss: JaxB DataHandler compatibility

问题描述:

I am using JBoss 5.1 (EAP). I am using Spring webservices (3.0.5).

For marshalling I am using JaxB.

I am using maven.jaxb2.plugin for generating pojo from the schema (xsd).

When I deploy the EAR on the JBoss, I get the following error:

19:05:52,524 ERROR [[eventmanager-ws]] Allocate exception for servlet eventmanager-ws

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts 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

uk.co.aol.shipmanager.ws.schema.ReportResponse.data

at uk.co.aol.shipmanager.ws.schema.ReportResponse

at public uk.co.aol.shipmanager.ws.schema.ReportResponse

uk.co.aol.shipmanager.ws.schema.ObjectFactory.createReportResponse()

at uk.co.aol.shipmanager.ws.schema.ObjectFactory

at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.j>ava:102)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:302)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1136)

at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)

at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)

at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:202)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)

at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)

at org.springframework.oxm.jaxb.Jaxb2Marshaller.createJaxbContextFromContextPath(Jaxb2Marshaller.java:>355)

at org.springframework.oxm.jaxb.Jaxb2Marshaller.getJaxbContext(Jaxb2Marshaller.java:328)

at org.springframework.oxm.jaxb.Jaxb2Marshaller.afterPropertiesSet(Jaxb2Marshaller.java:317)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingleto>BeanRegistry.java:222)

I've checked jaxb2 plugin version and tried using previous version with the assumption that the JBoss got JaxB 2.1.12, tried many version but no luck.

Any suggestions?

Thanks,

Adi

网友答案:

Somewhere in your entities you have field with type DataHandler. Mark this field with @javax.xml.bind.annotation.XmlTransient annotation

class SomeEntity  
{  
    //...   
   @javax.xml.bind.annotation.XmlTransient  
   private javax.activation.DataHandler yourField;  
   // ...  
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: