• 做Webservice时报错java.util.List是接口, 而 JAXB 无法处理接口。


    Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
    java.util.List是接口, 而 JAXB 无法处理接口。
    this problem is related to the following location:
    at java.util.List

    at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:471)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:303)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
    at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:167)
    at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111)
    at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:113)
    at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:94)
    ... 73 more

     counts of IllegalAnnotationExceptions and JAXB can't handle interfaces

    大致意思就是说返回值类型不能是接口类型。

    解决方法:将服务端的services接口返回的Map类型的值,改成HashMap.
    结论:在做webServices复杂类型值传递时,返回值的类型不要用接口类型。例如(List应该改为ArrayList,Map改为HashMap等)

  • 相关阅读:
    NET 事件与委托
    NET高级 REF OUT
    缓冲池
    NET高级 EQUAL相等
    装箱拆箱
    CTS、CLS、CLR
    结构体及引用类型
    NET高级-深拷贝浅拷贝
    密闭类 静态 类及扩展方法
    NET高级-索引器
  • 原文地址:https://www.cnblogs.com/summary-2017/p/8835964.html
Copyright © 2020-2023  润新知