异常问题:
[http-nio-8980-exec-8] ERROR [o.a.c.c.C.[.[localhost].[/].[dispatcherServlet]] DirectJDKLog.java:175 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.flowable.ui.common.service.exception.BadRequestException: Model cannot be updated: 8159d259-6ea1-11ec-a8fa-3c9509625d1a] with root cause
org.flowable.ui.common.service.exception.BadRequestException: Model cannot be updated: 8159d259-6ea1-11ec-a8fa-3c9509625d1a
at org.flowable.ui.modeler.rest.app.ModelResource.updateModel(ModelResource.java:129)
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:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
……
最近用springboot2.6 + flowable6.4 + flowable modeler 6.4 搭建流程引擎项目,参考了大神的文章:springboot2.1.6集成flowable modeler 6.4.2整合实现在线编辑免登录 - 灰信网(软件开发博客聚合)springboot2.1.6集成flowable modeler 6.4.2整合实现在线编辑免登录,灰信网,软件开发博客聚合,程序员专属的优秀博客文章阅读平台。https://www.freesion.com/article/61841027698/
项目起来后编辑流程模型报以上异常,新增是ok的,debug代码,没找到问题所在。仔细对比发现新增模型时名称是英文保存成功,编辑时名称改中文保存报错,再查数据库表字段的字符集非utf8,那问题就明朗了,是字符集的问题。
于是想着写命令修改表和字段的字符集,发现ACT_DE_开头的表外键太多了,根本改不动。琢磨着先删外键再改字符集再加回外键,后来想到flowable初始化可以重建表,索性把flowable相关的表全部删掉重头再来。关键一点,先把数据库的字符集设置成utf8。随着项目重启,表全回来了,字符集也正确了。最后尝试新建、编辑模型名称用中文,保存成功。