flowable变量获取失败
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flowable变量获取失败相关的知识,希望对你有一定的参考价值。
spring bootflowable中反序列化流程变量失败Couldn‘t deserialize object in variable ‘xxxx‘
forgetmetoo
原创
关注
0点赞·1400人阅读
flowable中反序列化流程变量失败Couldn't deserialize object in variable 'xxxx'
devops自动化项目中使用flowable(类似于activiti的流程引擎)来进行自动化流程编排,需要将每个步骤执行的结果使用流程变量来保存,由于数据类型未知,采用fastjson来保存对象变量,使用flowable的api进行变量存储:
Map<String, Object> rootNodeMap = new HashMap<>();
String responseNode = "response";
String requestNode = "request";
// 省略resultMap处理
// 省略resultMap处理
rootNodeMap.put(responseNode, resultMap);
rootNodeMap.put(requestNode, requestMap);
runtimeService.setVariable(processInstanceId, "rootNode", rootNodeMap);
登录后复制
由于流程变量中包含有对象嵌套数组的情况,在使用fastjson的JSONObject保存了主节点以后,在后续使用rootNode变量时,会出现反序列化失败的情况。具体错误堆栈如下:
org.flowable.common.engine.api.FlowableException: Couldn't deserialize object in variable 'rootNode'
at org.flowable.variable.service.impl.types.SerializableType.deserialize(SerializableType.java:117)
at org.flowable.variable.service.impl.types.SerializableType.getValue(SerializableType.java:65)
at org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntityImpl.getValue(VariableInstanceEntityImpl.java:132)
at org.flowable.variable.service.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:271)
at org.flowable.variable.service.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:250)
at org.flowable.common.engine.impl.el.VariableContainerELResolver.getValue(VariableContainerELResolver.java:39)
at org.flowable.engine.impl.el.ProcessVariableScopeELResolver.getValue(ProcessVariableScopeELResolver.java:57)
at org.flowable.common.engine.impl.javax.el.CompositeELResolver.getValue(CompositeELResolver.java:234)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:95)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstProperty.eval(AstProperty.java:68)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstProperty.eval(AstProperty.java:68)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstBinary$SimpleOperator.eval(AstBinary.java:31)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstBinary.eval(AstBinary.java:112)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:53)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:31)
at org.flowable.common.engine.impl.de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)
at org.flowable.engine.impl.delegate.invocation.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:34)
at org.flowable.engine.impl.delegate.invocation.DelegateInvocation.proceed(DelegateInvocation.java:35)
at org.flowable.engine.impl.delegate.invocation.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:26)
at org.flowable.engine.impl.el.JuelExpression.resolveGetValueExpression(JuelExpression.java:44)
at org.flowable.common.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)
at org.flowable.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:37)
at org.flowable.engine.impl.util.condition.ConditionUtil.hasTrueCondition(ConditionUtil.java:47)
at org.flowable.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:84)
at org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:39)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:275)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:159)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:114)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:327)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:80)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:56)
at org.flowable.common.spring.SpringTransactionInterceptor$$Lambda$532/1508152985.doInTransaction(Unknown Source)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:56)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:208)
at com.dashuf.srgp.workflow.devops.DevopsTaskAutoCompletedHandler.autoComplete(DevopsTaskAutoCompletedHandler.java:41)
at com.dashuf.srgp.workflow.devops.DevopsTaskAutoCompletedHandler$$FastClassBySpringCGLIB$$f48068ba.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$$Lambda$663/1969812924.call(Unknown Source)
at com.dashuf.srgp.config.CustomThreadPoolTaskExecutor.lambda$submit$8(CustomThreadPoolTaskExecutor.java:46)
at com.dashuf.srgp.config.CustomThreadPoolTaskExecutor$$Lambda$664/488650178.call(Unknown Source)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
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: com.alibaba.fastjson.JSONException: autoType is not support. [B
at com.alibaba.fastjson.parser.ParserConfig.checkAutoType(ParserConfig.java:920)
at com.alibaba.fastjson.parser.ParserConfig.checkAutoType(ParserConfig.java:911)
at com.alibaba.fastjson.JSONObject$SecureObjectInputStream.resolveClass(JSONObject.java:548)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1664)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)
at java.io.ObjectInputStream.access$300(ObjectInputStream.java:206)
at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2157)
at java.io.ObjectInputStream.readFields(ObjectInputStream.java:541)
at java.math.BigInteger.readObject(BigInteger.java:4258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)
at java.math.BigDecimal.readObject(BigDecimal.java:3748)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)
at com.alibaba.fastjson.JSONObject.readObject(JSONObject.java:488)
at sun.reflect.GeneratedMethodAccessor1138.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.flowable.variable.service.impl.types.SerializableType.deserialize(SerializableType.java:113)
... 57 common frames omitted
登录后复制
看字面意思理解,应该是无法识别关键字[B,猜测应该是fastjson在序列化的时候写入class的数据类型,看起来像是Byte数组之类,目前使用的fastjson版本是1.2.49版本,在github搜索了一下,目前最新版本已经到1.2.76,并且中间有一些issue提到Array、Map等,和我的应用场景比较相似,这些issue已经进行了升级解决。
于是尝试着将fastjson版本升级到1.2.76,再次执行,成功通过,问题解决。
这个问题排查定位从上周五的晚上一直到本周一的早上,持续时间很长,但是修改方式却非常简单,只是升级了fastjson的版本而已,之前一直没有怀疑是fastjson的问题,而是将重点放在自己的中间数据处理上面。所以后续遇到类似问题,可以先尝试这种快捷的方案,节约时间。
devops
activiti
java
spring boot
个人写真照片
精选推荐
广告
Couldn't deserialize object in variable 'user1' 反序列化失败
4620阅读·0评论·0点赞
2017年2月17日
org.activiti.engine.ActivitiException: coudn‘t deserialize object in variable ‘a‘.获取流程变量无法反序列化问题。
1025阅读·0评论·2点赞
2019年10月20日
解决:Caused by: org.flowable.common.engine.api.FlowableWrongDbException: version,问题
5893阅读·0评论·1点赞
2021年5月21日
org.activiti.engine.ActivitiException: Couldn't deserialize object in variable 'application'
619阅读·0评论·0点赞
2016年12月23日
Cannot construct instance of `com.*` (although at least one Creator exists): cannot deserializ
3.0W阅读·7评论·6点赞
2020年3月3日
个人委托律师授权委托书,专业经验丰富
精选推荐
广告
[Flowable6.4.1]DMN报错Error parsing '#input1 == >19 ': syntax error at position 13, encountered '>'...
2336阅读·0评论·0点赞
2019年4月15日
Flowable 一些异常报错、注意事项(4)
1532阅读·0评论·1点赞
2022年4月21日
Flowable实战(一)启动第一个完整流程
2661阅读·5评论·13点赞
2022年1月7日
Activity FlowableException: Couldn't serialize value
874阅读·0评论·0点赞
2019年12月29日
Flowable工作流兼容达梦数据库
1332阅读·0评论·0点赞
2021年10月8日
使用Mycat时,activiti出现异常 Couldn‘t deserialize object in variable ‘assignee‘
610阅读·0评论·0点赞
2020年9月23日
使用Mycat时,activiti出现异常 Couldn't deserialize object in variable 'assignee'
4448阅读·2评论·0点赞
2018年8月17日
flowable 流程表单_Flowable 实现【选择下一步流程审核人】
1258阅读·0评论·0点赞
2020年12月19日
java 类不能序列化_Java : 实体类不能序列化异常
363阅读·0评论·0点赞
2021年2月13日
activiti在运行时报错:couldn‘t find a variable type that is able to serialize XXX
1224阅读·0评论·0点赞
2021年3月30日
Flowable FlowableException:flowable-exclusive-gateway-condition-not-allowed-on-single-seq-flow
570阅读·1评论·1点赞
2022年3月21日
Activiti基础 condition expression returns non-Boolean 解决方案
1.3W阅读·7评论·5点赞
2018年8月19日
nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data mo 参考技术A flowable变量获取失败?
你好!建议devops自动化项目中使用flowable(类似于activiti的流程引擎)来进行自动化流程编排,需要将每个步骤执行的结果使用流程变量来保存,由于数据类型未知,采用fastjson来保存对象变量,使用flowable的api进行变量存储 参考技术B flowable变量获取失败?
你好!建议devops自动化项目中使用flowable(类似于activiti的流程引擎)来进行自动化流程编排,需要将每个步骤执行的结果使用流程变量来保存,由于数据类型未知,采用fastjson来保存对象变量,使用flowable的api进行变量存储
以上是关于flowable变量获取失败的主要内容,如果未能解决你的问题,请参考以下文章