Having issues more than 4000 char

Hi Team,

Am facing an issue for storing data, having more than 4000 Char…
SEVERE: ENGINE-16004 Exception while closing command context: ENGINE-03004 Exception while executing Database Operation ‘INSERT HistoricVariableInstanceEntity[1e63ed1c-98bf-11e7-91a1-005056b11dbe]’ with message ’

Error updating database. Cause: java.sql.SQLDataException: ORA-01401: inserted value too large for column

The error may involve org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance-Inline

The error occurred while setting parameters

SQL: insert into ACT_HI_VARINST ( ID_, PROC_DEF_KEY_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TENANT_ID_, CASE_DEF_KEY_, CASE_DEF_ID_, CASE_INST_ID_, CASE_EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_, TEXT_, TEXT2_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: java.sql.SQLDataException: ORA-01401: inserted value too large for column

'. Flush summary:
INSERT HistoricVariableInstanceEntity[1e63ed1c-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1f062091-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1f0c8939-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1f0ed32e-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1fb80b82-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1fb80b84-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1fb80b86-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1fb80b88-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[1fb8329a-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[2039226d-98bf-11e7-91a1-005056b11dbe]
INSERT HistoricVariableInstanceEntity[203b6c63-98bf-11e7-91a1-005056b11dbe]

Can anyone please help me here.

Thanks & Regards,

You are saving a variable that is a string and larger than 4000 characters.

Can you share some of your code/bpmn? What are you saving that is so large?

The workaround for this is to save a custom object (or a JSON or xml object) which will be saved as blobs in the db.

Here is the scenario

I am calling another camunda BPMN process from my camunda BPMN process. Other process is calling a REST service and returning the response to me.
To implement this, the other BPMN implementer has provided me with message name, request and response variables names. I have provided screeshot below of how I have implemented it in camunda BPMN tool (figure 1)
In figure 2 below that I have shown how I have set up the request and response variables in my BPMN process (as supplied by implementer of Second BPMN process).

When my process exectues, it places request XML in request variable inputRequestVar
Second BPMN process reads the request xml, calls external REST service and saves the response xml in variable outputResponseVar

Once the second process ends, I see error in my process as soon as my BPMN process tries to read the outputResponseVar. Please see attached log file. I have also attached full log of my BPMN execution which is superset of error log.
Here please note that this reading is handled automatically by camunda. I am not performing any explicit read action or store action in code.
In figure 3 below I have captured screenshot of Second BPMN with its response variable. Do revert if yo need more info or clarification.\

Note: you may see that variable names in screenshot below are different from logs. That is because I created a dummy BPMN to capture the screenshots.

Figure 1

Fig 2

Figure 3

Please find the attachment.


Store your xml as a spin xml object. Look in the docs for “Spin xml”

In general, is it true that the value of variables is limited to 4000 characters ?
If yes, is there any plan to remove this limitation in the coming releases ?

Is there any way to overcome the 4000 limit by tweaking teh database column width ( ALTER TABLE ) ?

@sonyantony why cant you store your text as a SPIN XML object?

1 Like

Where can I get more info on teh concept of spin xml ? Your link only talks about how to use it.
Also can you give an example for spin xml being created by the called BPMN process and passed to the calling BPMN process

@sonyantony read the documentation, there are multiple examples of its use, and search the forums as there are multiple form threads that discuss various uses of SPIN.

This is a very common error and has been an issue int eh Aciviti codebase for many years.
Obviously the correct answer is to store the majority of the data in an external store and only maintain a pointer/reference within the process itself.
If that’s not possible, in the past we have overloaded the History Manager to detect > 4000 and handle accordingly.

We too have run into this. The key is to store things as JSON objects. They will then be stored in the ACT_GE_BYTEARRAY table and their size will not matter. In other words, when the process variable or other “object” is instantiated, it must be instantiated as a JSON object (which is what nearly all of data is) or other object class. Camunda will automatically recognize this and store it in the byte array table.

You’re probably going to have to hand code around this issue. This “problem” exists throughout Camunda including in the DMN engine. In DMN, you may have to set input and output columns manually (i.e. direct editing of the underlying XML) to JSON. I’m not sure about XML.

The bottom line is, if the value exceeds 4000 characters, it needs to be an object of some sort, at least in my experience.

You could make the database column wider, but then you would need to remember to do that for any future upgrades. Personally, with the exception of a few additional indices, I wouldn’t mess with the Camunda database.

1 Like

For completeness, check JSON native variable out: https://docs.camunda.org/manual/7.11/user-guide/data-formats/json/#native-json-variable-value

1 Like