AnsweredAssumed Answered

lazy loading outside command context error

Question asked by fatma19 on May 15, 2017
Latest reply on May 22, 2017 by gdharley

I am currently developping a java jee application using activiti as process engine and alfresco as ged.i am using mvc design pattern and micro services to make rest calls for the backend  project.I want to pass a list of ProcessInstances via the controller,but i got this error.

Etat HTTP 500 - Could not write content: lazy loading outside command context (through reference chain: java.util.ArrayList[0]->org.activiti.engine.impl.persistence.entity.ExecutionEntity["variableInstances"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: lazy loading outside command context (through reference chain: java.util.ArrayList[0]->org.activiti.engine.impl.persistence.entity.ExecutionEntity["variableInstances"])

 

By the way the service works fine when i test it without rest call.

this is my controller:

 


@RestController
public class CourriersArrivésController {
CourriersArrivésServices courriersArrivésServices;
@RequestMapping(value = "/listCourriersArrivés", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public List<ProcessInstance> getAllCourriers(){
courriersArrivésServices=new CourriersArrivésImpl();

List<ProcessInstance> listeCourrier = courriersArrivésServices.getListCourriersArrivées() ;

return listeCourrier ;
}
}

Outcomes