2012-04-27 53 views
5

我正在使用JBoss 5.1(EAP)。我使用Spring webservices(3.0.5)。 對於編組,我使用JaxB。JBoss:JaxB DataHandler兼容性

我正在使用maven.jaxb2.plugin從模式(xsd)生成pojo。

當我部署JBoss的EAR中,我得到以下錯誤:

 
    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) 

我檢查JAXB2插件版本,並使用以前版本的假設,即在JBoss得到了JAXB 2.1.12嘗試,嘗試了很多版本,但沒有運氣。

有什麼建議嗎?

感謝, 阿迪

回答

0

某處在你的實體您有場DataHandler類型。標記此字段爲 @javax.xml.bind.annotation.XmlTransient註釋

class SomeEntity 
{ 
    //... 
    @javax.xml.bind.annotation.XmlTransient 
    private javax.activation.DataHandler yourField; 
    // ... 
} 
+0

我有同樣的錯誤。使用wsimport從wsdl生成客戶端。與我的jboss 5.1 GA有什麼關係? – Christian13467 2015-06-23 19:22:11