zoukankan      html  css  js  c++  java
  • 做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等)

  • 相关阅读:
    sql 中 in 与 exist 的区别
    with as (cte common table expression) 公共表表达式
    配置连接数据库的方式
    Dispose 与 close 方法 的区别
    抽象类
    default
    什么叫无符号整型
    hdu 5187 zhx's contest [ 找规律 + 快速幂 + 快速乘法 || Java ]
    poj 2480 Longge's problem [ 欧拉函数 ]
    lightoj 1293
  • 原文地址:https://www.cnblogs.com/summary-2017/p/8835964.html
Copyright © 2011-2022 走看看