error with Rest api context plugin



I try to use the restapi_content '' in one of my projects but I encounter an error ' org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role'

The exception is raised in 'at'

My case is very simple :I have a list of main objects which contains one composition and one aggregation.

My form list the main objects;

I select one and put the selected one in a processus variable and that's it.

I try to reproduce this error in the given example 'DemonstrateRestApiContext-2.7.bos' by creating in the 'testBDM' proc a simple process variable 'header1' which contains : "
def header = headerDAO.findByPersistenceId(1);
return header;

in this case I got an error ' Caused by: java.lang.ClassNotFoundException:'

I have the impression that the build of the context does not process correctly composition or aggregation relations (the call of the http://localhost:7256/bonita/portal/resource/taskInstance/testBdm/2.7/bd... is on error 500).

What do you think ?

[ Update : I see in the code of the plugin that process variable in method completeValueProcessVariable of RestContextHandleGet - at the contrary of the biz variable (completeValueBdmData method of RestContextHandleGet) - are not serialized. Probably were the plugin is buggy as the reference of the object is sent in the context request. ]

Thanks for your help

Best regards


1 answer


Hello Genevieve,

I notice that I didn't commit the last version, 2.13.3. This is not a big change (change the import to run on 7.11), but it's better to use it.
Could you use it instead?

Second, looking at the example, we have
a Business Object Header which contains 3 objects.

Line / Multiple / Composition

Ticket / Single / Aggregation

Header / Single / Aggregation

The summerOrder variables contain multiple lines, and one ticket (DemonstrateRestApiContext 2.9.2 / testbdm process)

We got the answer in JSON

"summerOrder": {
"ticket": {
"idTicket": 12,
"solicitante": "Name of the Solicitante",
"persistenceId": 65
"name": "Name 1.0 of the day processInstanceId[2001]",
"lines": [
"ticket": {
"solicitante": "Line 1"
"price": 100.0,
"linename": "Line 1 / BPAD Training"

Note: we don't get the other variable dues to the globalContext. The globalContext (a process variable) declare to return only this variable.
So, everything runs well.

Note; I see the error

Caused by: java.lang.ClassNotFoundException:

in the log file. The origine is not the REST API CONTEXT, but

org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=7014025418239373645 | PROCESS_NAME=testBdm | PROCESS_VERSION=2.9.2 | PROCESS_INSTANCE_ID=2001 | ROOT_PROCESS_INSTANCE_ID=2001 | FLOW_NODE_DEFINITION_ID=5558211607539856960 | FLOW_NODE_INSTANCE_ID=40003 | FLOW_NODE_NAME=BdmLocalContext | CONNECTOR_IMPLEMENTATION_CLASS_NAME=getBdm | CONNECTOR_INSTANCE_ID=20001 | Unknown declared return type for expression summerOrder

This is due in line 22

classDAOName = "";
In 7.11, this class change to "com.bonita.context.HeaderDAO"
==> Please use version 2.13.3 where I fix this too.
So, in your example, you load a Business Object header. So, I assume this comes you face come from data?

Could you:
1/ create a process where you generate the data (not load from an existing one)
2/ share this process?
Then we can have a look at your issue.