REST - Empty response on JSON layergroup


When the layergroup is added and contains layers without styles, the JSON responses return HTTP 200, but are empty. XML responds normally/as expected. Problem surfaces with multiple layers ~ 5 in the layer group.

there is an error in the JSON parser causing non-matching close brackets for null values ocurring in the geoserver XStreamPersister, eg:

The expected behavior here would be something like:




Torben Barsballe
September 27, 2016, 9:56 PM

This appears to be an error in the JettisonStaxWriter. From what I can determine, this may be fixed in newer versions (1.2), but these versions are incompatible with XStream, so no luck there.

Torben Barsballe
September 27, 2016, 11:28 PM

Fix here:

For future reference, a breakdown of the cause of this issue follows:

The GeoServer XStream Persister uses com.thoughtworks.xstream for XStream encoding. This supports XML, HTML, and JSON (by way of the Jettison library) as output formats.

JSON and XML have very different internal structure. One of the ways the Jettison writer gets around this is converting any nodes of the same name at the same level into an array. So for example, this XML:

Would be equivalent to this JSON:

However, there is a bug in Jettison that occurs when the list has empty values (which is how GeoServer encodes null values). In this instance, the JSON contains an eroneous closing bracket for each empty value, causing the response to terminate early and in an invalid way, leading to the error we encoundered in this ticket.

From what I could find, this bug has been fixed in newer versions on Jettison, however these newer versions are not compatible with any version of the XStream library we are using to wrap Jettison.




Jonathan Hankes



Fix versions

Affects versions