REST route: /process-instance/{id}/variables
Variables Passed: vars.put( key, new VariableInstanceValueType( Variables.byteArrayValue( ( activityVariablesObject.toString() ).getBytes() ), byte[].class.getSimpleName() ) );
Error: org.camunda.bpm.engine.rest.exception.RestException: Unsupported value type 'byte[]'Variables Passed: vars.put( key, new VariableInstanceValueType( Variables.byteArrayValue( ( activityVariablesObject.toString() ).getBytes() ), Object.class.getSimpleName() ) );
Error: Caused by: org.camunda.bpm.engine.rest.exception.InvalidRequestException: Must provide 'null' or String value for value of SerializableValue type 'Object'.Caused by: org.codehaus.jackson.JsonParseException: Failed to decode VALUE_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character '{' (code 0x7b) in base64 content at [Source: java.io.StringReader@5b396c3; line: 1, column: 3]So I tried the JSON String option, with some progress....
The large variable appears to be accepted by the POST, but is returned as null when retrieved through REST route, and the REST interface gives the following exception
"errorMessage":"Cannot deserialize object in variable 'stackTrace': SPIN/JACKSON-JSON-01001 Unable to parse input into json node"
I'll do some digging into SPIN as I've not explicitly used it before, but if anyone can shed any light on this error in the mean time it would be appreciated.
Kind Regards
Gareth
execution.setVariable("book", Variables.objectValue(book).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create());
This seems to work, but not if the object is too large (I think >2MB XML size), then I get a stackoverflow error from Camunda when trying to execute the above statement.
What am I doing wrong? Is there a better approach to save such variables?
Thanks,
Matthias
Variables.byteArrayValue( ( book.toString() ).getBytes() )
( This wont fix the underlying blob size, but is a different approach incase its something else )
Can you provide the full stack trace ?
Kind Regards
Gareth
execution.setVariable("imagenodes", Variables.objectValue(imagenodes).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create());
08-Dec-2015 13:34:15.441 SEVERE [pool-3-thread-1] org.camunda.bpm.engine.impl.interceptor.CommandContext.close Error while closing command context org.camunda.bpm.engine.ProcessEngineException: Error while evaluating expression: ${NlmImportService.importImages(execution)}. Cause: java.lang.StackOverflowError at org.camunda.bpm.engine.impl.el.JuelExpression.getValue(JuelExpression.java:59) at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:44) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:42) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:27) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:484) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:464) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:56) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:26) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:473) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:473) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:484) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:464) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope.scopeCreated(PvmAtomicOperationTransitionCreateScope.java:34) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:50) at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:24) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:484) at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:464) at org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake.eventNotificationsCompleted(AbstractPvmAtomicOperationTransitionNotifyListenerTake.java:37) at org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake.eventNotificationsCompleted(AbstractPvmAtomicOperationTransitionNotifyListenerTake.java:28) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) at org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:90) at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:123) at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:100) at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:97) at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32) at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79) at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)Caused by: org.camunda.bpm.engine.impl.javax.el.ELException: java.lang.StackOverflowError at org.camunda.bpm.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:481) at org.camunda.bpm.engine.impl.javax.el.CompositeELResolver.invoke(CompositeELResolver.java:397) at org.camunda.bpm.engine.impl.juel.AstMethod.invoke(AstMethod.java:91) at org.camunda.bpm.engine.impl.juel.AstMethod.eval(AstMethod.java:75) at org.camunda.bpm.engine.impl.juel.AstEval.eval(AstEval.java:50) at org.camunda.bpm.engine.impl.juel.AstNode.getValue(AstNode.java:26) at org.camunda.bpm.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114) at org.camunda.bpm.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33) at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:39) at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59) at org.camunda.bpm.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50) ... 47 moreCaused by: java.lang.StackOverflowError at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getRealPrevSibling(DeferredDocumentImpl.java:886) at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getRealPrevSibling(DeferredDocumentImpl.java:877) at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getNodeValueString(DeferredDocumentImpl.java:1157) at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getNodeValueString(DeferredDocumentImpl.java:1134) at com.sun.org.apache.xerces.internal.dom.DeferredTextImpl.synchronizeData(DeferredTextImpl.java:96) at com.sun.org.apache.xerces.internal.dom.NodeImpl.writeObject(NodeImpl.java:2017) at sun.reflect.GeneratedMethodAccessor495.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)Element book = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new InputSource(new ByteArrayInputStream(bytes))).getDocumentElement();
ArrayList<Node> imagenodes = new ArrayList<>();
final NodeList images = book.getElementsByTagName("graphic");
for (int i = 0; i < images.getLength(); i++) {
imagenodes.add(images.item(i));
}
execution.setVariable("imagenodes", Variables.objectValue(imagenodes).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create());When I trimmed by output to be below 4000 characters, the errors went away.
In my case, it was output from running a command on a remote server. I handled it like this:
execution.setVariable("stdOut", stdoutString.substring(0, ( stdoutString.length()>3999?3999:stdoutString.length() ))) ;
The alternative would be to modify the column size of the Camunda persistence database wherever it was (H2, MySQL, etc.).
If you're using H2 on your local workstation, then you can get to the Query tool at localhost:8080/H2/H2
I see no reason why this couldn’t be increased or the data type changed, but our Camunda friends would need to weigh in on this. I, in particular, would need much larger column sizes because I will be capturing unstructured output that I want to preserve.
However, I hesitate to modify anything in that database for fear of unintended consequences.
Michael