JSON Serialization Broken in REST API (CXF)

Description

Since the move to CXF, JSON serialization is now completely broken a a number of REST endpoints, and different then the previous output on some others.

These URLs fail with overflow errors:

These fail with empty bean exceptions:

And this one has slightly different output then seen on demo:

This is not an exhaustive list, but it demonstrates some of the current problems.

In CXF, we're currently using Jackson as a JSON provider, whereas in Jersey we used a mapper that leveraged the existing JAXB annotations.

An attempt to use Jettison as a JSON provider in CXF fixed the exceptions and overflow errors, but produced different JSON output then what was previously rendered.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Ronny Trommer April 1, 2016 at 8:20 PM

seems to be fixed can we delete this branch? https://github.com/OpenNMS/opennms/tree/feature-NMS-7802-json-tests

Seth Leger July 22, 2015 at 10:21 AM
Edited

The easiest and best option was "Use the Jackson JAXB JSON serializer". It appears to work the same as the old Jersey serializer. I switched everything back in develop and the JSON tests that I wrote for 16 worked in 17. Marking as fixed.

commit 3f43e56dcd892d112e6ef4765517d1a21bfe9d29

Seth Leger July 16, 2015 at 2:46 PM

I'm going to go back to the release-16.0.3 branch and write a bunch of unit tests for JSON serialization there (that will pass because 16 is using Jersey and the Jersey JAXB JSON serialization). Then I'll merge the unit tests forward and see what is failing under CXF and try and figure out a way to make the serialization identical. There are several options for fixing the problems:

  • Use the Jersey JAXB JSON serializer in CXF for REST v1

  • Use the Jackson JAXB JSON serializer (which we haven't used before anywhere)

  • Add annotations to make the Jackson JSON serializer behave the same as Jersey JAXB JSON

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created July 14, 2015 at 4:20 PM
Updated April 1, 2016 at 8:20 PM
Resolved July 22, 2015 at 10:21 AM

Flag notifications