Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-8302

Json deserialization throws "unknown property" exception due to usage of wrong Jax-rs Provider

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 18.0.0
    • Component/s: BSM
    • Labels:
      None
    • Sprint:
      BSM - Sprint 5, BSM - Sprint 6

      Description

      It is currently not possible to use the BusinessServiceRestService ("/business-services") REST API with Json.

      Somehow the Rest implementation uses the JacksonJsonProvider instead of the JaxbJacksonJsonProvider. This means that all JAXB annotations (e.g. @XmlElement) are not interpreted correctly and an Excepetion is thrown while deserializing a Java Object to Json (due to missing @JsonProperty annotations).

      For now I disabled tests which try to serialize/deserialize Json objects (via Rest). Be aware that serialize/deserialize in the unmarshal tests (e.g. IpServiceResponseDTOMarshalTest) works just fine.

      To reproduce this issue navigate to the class BusinessServiceRestServiceIT and uncomment the lines which send Json formatted data to the Rest Service Implementation, e.g.

       sendData(POST, MediaType.APPLICATION_JSON, "/business-services", toJson(toRequestDto(bs)), 201);
      

      Both Xml and Json should work.

        Attachments

          Activity

            People

            Assignee:
            j-white Jesse White
            Reporter:
            mvr Markus von RĂ¼den
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: