关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 15574|回复: 1

新人求助:不能用参数指定任务参与者

[复制链接]
发表于 2016-12-27 00:45:09 | 显示全部楼层 |阅读模式
我的意图是用applyUserId表示当前发起流程者,用变量${deptLeaderId}指定部门领导,用变量${hrGroupId}指定人事审批参与组。
leave.bpmn20.xml的相关代码如下
<startEvent id="startevent1" name="开始" activiti:initiator="applyUserId"></startEvent>
    <userTask id="deptLeaderAudit" name="部门领导审批" activiti:assignee="${deptLeaderId}">
      <documentation>deptLeader.jsp</documentation>
    </userTask>
    ...
    <userTask id="hrAudit" name="人事审批" activiti:candidateGroups="${hrGroupId}">
      <documentation>hr.jsp</documentation>
    </userTask>
    ...
   
Java代码如下:
identityService.setAuthenticatedUserId(userId);//将用户ID设置到当前的线程中
Map<String,Object> variableMap = new HashMap<String,Object>();
variableMap.put("deptLeaderId","40284681575cbfbd01575cd505070012");
variableMap.put("hrGroupId","40284681575cbfbd01575cd21a18000c");
processInstance = this.runtimeService.startProcessInstanceById("leave:5:18713", businessKey, variableMap);

报错如下:
DEBUG- insert HistoricVariableInstanceEntity[id=26258, name=applyUserId, revision=0, type=string, textValue=8a8ab0b246dc81120146dc8181950052]
DEBUG- insert HistoricVariableInstanceEntity[id=26262, name=attendanceGroupId, revision=0, type=string, textValue=40284681575cbfbd01575cd21a18000c]
DEBUG- insert HistoricVariableInstanceEntity[id=26264, name=deptLeaderId, revision=0, type=string, textValue=40284681575cbfbd01575cd505070012]
00:28:09.577 [http-bio-8087-exec-8] DEBUG o.a.e.i.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
### The error may involve org.activiti.engine.impl.persistence.entity.HistoricDetailEntity.bulkInsertHistoricDetailVariableInstanceUpdate-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)     values                   (?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?)        ,          (?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?)        ,          (?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?,          ?)
### Cause: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.1.1.jar:3.1.1]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147) ~[mybatis-3.1.1.jar:3.1.1]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134) ~[mybatis-3.1.1.jar:3.1.1]
    at org.activiti.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:850) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.db.DbSqlSession.flushPersistentObjects(DbSqlSession.java:820) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:797) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:618) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138) ~[activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66) [activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) [activiti-spring-5.21.0.jar:5.21.0]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE]
    at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) [activiti-spring-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37) [activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) [activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) [activiti-engine-5.21.0.jar:5.21.0]
    at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:118) [activiti-engine-5.21.0.jar:5.21.0]
    at org.jeecgframework.web.activiti.service.impl.LeaveServiceImpl.leaveWorkFlowStart(LeaveServiceImpl.java:60) [LeaveServiceImpl.class:na]
    ...
Caused by: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    at com.mysql.jdbc.PreparedStatement.setSerializableObject(PreparedStatement.java:3829) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3559) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    ... 75 common frames omitted
Caused by: java.io.NotSerializableException: org.activiti.engine.impl.variable.StringType
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164) ~[na:1.6.0_39]
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) ~[na:1.6.0_39]
    at com.mysql.jdbc.PreparedStatement.setSerializableObject(PreparedStatement.java:3818) ~[mysql-connector-java-5.1.40.jar:5.1.40]
    ... 99 common frames omitted
我用的环境是jdk1.6,mysql数据库,mysql-connector-java-5.1.40.jar驱动,activiti-engine-5.21.0版本。

这个问题困扰我好几天了,万能的互联网,请显灵吧!!!!

发表于 2017-5-1 23:47:30 | 显示全部楼层
是mybatis.version版本的问题。调整成3.2.5版本即可
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表