lazy loading outside command context error

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

lazy loading outside command context error

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 ;
}
}

3 Replies
Highlighted
Intermediate

Re: lazy loading outside command context error

I actually dont have an answer as to why you are getting this error.

However, I see a very similar error has been experienced (with a work around) in this forum thread:
java - Activiti candidate group assignment implementation - Stack Overflow 

Hope this helps,
greg

Highlighted
Active Member II

Re: lazy loading outside command context error

yeah i have already did the same 

Highlighted
Intermediate

Re: lazy loading outside command context error

Hmm, When you say it works when you test without the rest call, how are you calling it? That may give a hint to the reason.

G