Web サービスをブラウザから直接呼び出せるようにしたいと考えています。Web ブラウザーを介して HTTPClient から呼び出すことは問題ありませんが、ブラウザーを介して直接呼び出しようとすると、次のエラーが発生します。
SEVERE: [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Could not instantiate JAXBContext for class [class com.mycompanay.MyClass]: 8 counts of IllegalAnnotationExceptions; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 8 counts of IllegalAnnotationExceptions
com.mycompany.MyInterface is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
com.mycompany.myInteface
at private java.util.List com.mycompanay.MyClass.values
at com.mycompanay.myClass
@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
this problem is related to the following location:
@XMLElement アノテーションを使用して実装クラスを参照しようとしましたが、同じエラーが発生します。
public MyClass {
@XmlElement(type=MyInterfaceImpl.class, name="values")
private List<MyInterface> values;
@XmlElement(type=MyInterfaceImpl.class, name="values")
public void getValues() {
return values;
}
}