JSON Serialization of Process with Lane leads to infinite recursion

Description

If a Process uses the Lane feature, e.g.:

<process id="externalTradeProcess" isClosed="false" isExecutable="true" name="externe- & non-Trade Prozess" processType="None">
<extensionElements/>
<laneSet id="sid-79d94d4a-f800-47c3-89cd-c8a4e37279af">
<lane id="sid-F4CEB299-2E08-4A52-B07F-219111797D98" name="EAI\n">
[..]
</lane>
</laneSet>
[..]
</process>

the model REST endpoint, e.g.

/activiti-rest/service/repository/process-definitions/processDefinitionId:1:123456/model

makes the Jackson serializer run into an infinite recursion when attempting to serialize the parentProcess property:

{"processes":[{"id":"externalTradeProcess","xmlRowNumber":22,"xmlColumnNumber":4,"extensionElements":{},"name":"externe- & non-Trade Prozess","executable":true,"documentation":null,"ioSpecification":null,"executionListeners":[],"lanes":[{"id":"sid-F4CEB299-2E08-4A52-B07F-219111797D98","xmlRowNumber":25,"xmlColumnNumber":10,"extensionElements":{},"name":"EAI\n","parentProcess":{"id":"externalTradeProcess","xmlRowNumber":22,"xmlColumnNumber":4,"extensionElements":{},"name":"externe- & non-Trade Prozess","executable":true,"documentation":null,"ioSpecification":null,"executionListeners":[],"lanes":[{"id":"sid-F4CEB299-2E08-4A52-B07F-219111797D98","xmlRowNumber":25,"xmlColumnNumber":10,"extensionElements":{},"name":"EAI\n","parentProcess":{"id":"externalTradeProcess","xmlRowNumber":22,"xmlColumnNumber":4,"extensionElements":{},"name":"externe- & non-Trade Prozess","executable":true,"documentation":null,"ioSpecification":null,"executionListeners":[],"lanes":[{"id":"sid-F4CEB299-2E08-4A52-B07F-219111797D98","xmlRowNumber":25,"xmlColumnNumber":10,"extensionElements":{},"name":"EAI\n","parentProcess":{"id":"externalTradeProcess","xmlRowNumber":22,"xmlColumnNumber":4,"extensionElements":{},"name":"externe- & non-Trade Prozess","executable":true,"documentation":null,"ioSpecification":null,"executionListeners":[],"lanes":[{"id":"sid-F4CEB299-2E08-4A52-B07F-219111797D98" [..]

This causes a lengthy error to be thrown that floods both stack and the logfiles and obscures the problem:

10:13:35,906 SEVERE [org.restlet.Component.Server] (http--0.0.0.0-38080-5) An exception occured writing the response entity: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMappingException$Reference
at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) [jackson-mapper-asl-1.9.9.jar:1.9.9]
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) [jackson-mapper-asl-1.9.9.jar:1.9.9]
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) [jackson-mapper-asl-1.9.9.jar:1.9.9]
at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) [jackson-mapper-asl-1.9.9.jar:1.9.9]
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) [jackson-mapper-asl-1.9.9.jar:1.9.9]
[..]
(repeat until stack trace limit)

This is caused by org.activiti.bpmn.model.Lane having an un-annotated back reference to org.activiti.bpmn.model.Process:

public class Lane extends BaseElement {

protected String name;
protected Process parentProcess;
[..]
}

Adding a @JsonBackReference annotation fixes the problem!

Environment

JBoss AS 7.1.1

Assignee

Frederik Heremans

Reporter

Christian Huff

Labels

None

Components

Fix versions

Affects versions

Priority

Critical
Configure