Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6564

JAXB can't handle interfaces.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.2
    • NeedMoreInfo
    • JAX-RS
    • None
    • Unknown

    Description

      I have this particular payload:

      @XmlRootElement(name = "data")
      @XmlAccessorType(XmlAccess.Field)
      public class ResponsePayload{

      @XmlElement(name = "messages")
      @Setter
      @Getter
      private List<Map.Entry<String,String> messages
      }

      JAXB was working fine for converting the class to json payload with apache cxf 3.1.1.

      But with 3.1.2 it throws the following error:

      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
      java.util.Map$Entry is an interface, and JAXB can't handle interfaces.
      this problem is related to the following location:
      at java.util.Map$Entry
      at private java.util.List
      com.ResponsePayload
      at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:292)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1138)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247)
      at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234)
      at javax.xml.bind.ContextFinder.find(ContextFinder.java:441)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641)
      at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.getClassContext(AbstractJAXBProvider.java:515)
      at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.getJAXBContext(AbstractJAXBProvider.java:497)
      at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.createMarshaller(AbstractJAXBProvider.java:618)
      at org.apache.cxf.jaxrs.provider.json.JSONProvider.marshal(JSONProvider.java:622)
      at org.apache.cxf.jaxrs.provider.json.JSONProvider.writeTo(JSONProvider.java:393)
      ... 40 more

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sergey_beryozkin Sergey Beryozkin
            trippingpanda Abhishek Rawat
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment