将activiti的databaseSchemaUpdate设置为drop-create抛出DbSqlSession 错误

发布于2015-02-14 16:03:57 浏览7851次

 
 

今天在测试activiti的databaseSchemaUpdate属性的drop-create的时候一直抛出org.activiti.engine.impl.db.DbSqlSession错误信息,开始有点疑惑,折腾了很久才知道,原来是我将activiti数据库中的某些表或者记录删除,造成外键约束混乱,才会抛出这个错误。

错误信息:

7 [main] INFO org.activiti.engine.ProcessEngines - Initializing process engine using configuration 'file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml'

7 [main] INFO org.activiti.engine.ProcessEngines - initializing process engine for resource file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml

2015-2-14 9:20:40 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from resource loaded through InputStream

5562 [main] INFO org.activiti.engine.impl.db.DbSqlSession - performing drop on engine with resource org/activiti/db/drop/activiti.mysql.drop.engine.sql

12467 [main] ERROR org.activiti.engine.impl.db.DbSqlSession - problem during schema drop, statement drop index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti.act_ru_variable' doesn't exist

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)

at com.mysql.jdbc.Util.getInstance(Util.java:382)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2570)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:779)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:622)

at org.activiti.engine.impl.db.DbSqlSession.executeSchemaResource(DbSqlSession.java:930)

at org.activiti.engine.impl.db.DbSqlSession.executeSchemaResource(DbSqlSession.java:881)

at org.activiti.engine.impl.db.DbSqlSession.executeMandatorySchemaResource(DbSqlSession.java:698)

at org.activiti.engine.impl.db.DbSqlSession.dbSchemaDrop(DbSqlSession.java:679)

at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1000)

at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)

at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)

at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)

at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)

at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)

at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:72)

at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:363)

at org.activiti.engine.ProcessEngines.buildProcessEngine(ProcessEngines.java:194)

at org.activiti.engine.ProcessEngines.initProcessEnginFromResource(ProcessEngines.java:167)

at org.activiti.engine.ProcessEngines.init(ProcessEngines.java:98)

at org.activiti.engine.ProcessEngines.getProcessEngine(ProcessEngines.java:224)

at org.activiti.engine.ProcessEngines.getDefaultProcessEngine(ProcessEngines.java:217)

at com.bug315.ActivitiTest01.main(ActivitiTest01.java:15)

17427 [main] ERROR org.activiti.engine.impl.db.DbSqlSession - problem during schema drop, statement alter table ACT_RU_VARIABLE

drop FOREIGN KEY ACT_FK_VAR_EXE

解决办法:

手动将activiti的所有表删除,然后修改activiti.cfg.xml配置文件中的databaseSchemaUpdate=“drop-create”,最后启动activiti引擎,此时会出现表不存在等错误,因为表已经被你手动删除了。执行完后,再启动activiti引擎,这个问题就不再抛出了。

databaseSchemaUpdate属性的取值:

flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。

true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。

create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)。

drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)。

problem during schema drop, statement alter table ACT_RU_VARIABLE的更多相关文章

  1. problem during schema create,statement create sequence act_evt_log_seq

    今天在调试程序的时候出现"problem during schema create,statement create sequence act_evt_log_seq"这个错误,跟 ...

  2. [Hive - LanguageManual] Alter Table/Partition/Column

    Alter Table/Partition/Column Alter Table Rename Table Alter Table Properties Alter Table Comment Add ...

  3. ALTER TABLE - 修改表的定义

    SYNOPSIS ALTER TABLE [ ONLY ] name [ * ] ADD [ COLUMN ] column type [ column_constraint [ ... ] ] AL ...

  4. ALTER TABLE SWITCH' statement failed. The table x' is partitioned while index 'x' is not partitioned.

    1.L_Monitoring有这么些字段,ID,Collecttime,PlateType,PlateNO以及其他一些这段.建立这个表的时候是个非分区表,其中ID是主键,并在Collecttime,P ...

  5. sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP 'users_ibfk_1'; check that column/key exists") [SQL: ALTER TABLE users DROP FOREIGN KEY users_ibfk_1]

    flask 迁移数据库报错 报错: sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP ...

  6. My Sql 中要Alter Table的同学请注意!!!

    首先我建议你在对MySQL表做DDL操作时: 1 执行 show processlist 查看,要操作的表(数据库对象)是否处于锁状态 if("未锁定") { 执行DDL语句 }e ...

  7. Spark 2.x不支持ALTER TABLE ADD COLUMNS,没关系,我们改进下

    SparkSQL从2.0开始已经不再支持ALTER TABLE table_name ADD COLUMNS (col_name data_type [COMMENT col_comment], .. ...

  8. 【待整理】MySQL alter table modify vs alter table add产生state不一样

    MySQL:5.6.35 OS:redhat5.8 今天更新数据库某些表字段,有如下两SQL: ①alter table xx modify xxxx;(表大概是77w) ②alter table s ...

  9. 数据定义: CREATE、DROP、ALTER

    CREATE DATABASE 句法 CREATE DATABASE [IF NOT EXISTS] db_name 数据库.表.索引.列和别名 中被给出. 如果数据库已经存在,并且你没有指定 IF ...

随机推荐

  1. Firebird 表字段查询

    select rdb$relation_fields.rdb$relation_name table_name, rdb$relations.rdb$description table_des, rd ...

  2. [转]The NTLM Authentication Protocol and Security Support Provider

    本文转自:http://davenport.sourceforge.net/ntlm.html#ntlmHttpAuthentication The NTLM Authentication Proto ...

  3. MySQL---8、索引

    1.索引中关于搜索的算法  2.索引的使用原则  3.索引的优缺点  4.索引的种类  5.显示索引 show index from 表名;  6.创建唯一索引 alter table 表名 add ...

  4. [编程] C语言的结构体

    结构体 struct 结构体名{} 变量名; 结构体变量: struct person{ char *name; int age; float score; } student; 成员的获取和赋值 / ...

  5. Java Calendar Date使用总结

    Java Calendar Date使用总结 package cn.outofmemory.codes.Date; import java.util.Calendar; import java.uti ...

  6. 微信小程序button选中改样式-实现单选/多选

    小程序实现多button单选/多选 红色为选中状态 单选 多选 ①wxss /* pages/button-select/button-select.wxss */ .button_container ...

  7. Hibernate与mybatis比较

    Hibernate与mybatis比较 1.先说底层: a)Jdbc:全称java数据库连接,是java语言用来规范客户端如何访问数据库的程序接口. b) 一般步骤: i.加载驱动程序 ii.获得数据 ...

  8. eclipse中实现文本换行

    Eclipse 使用系统内置的“ Text Editor ”做为文本编辑器,这个文本编辑器有一个问题,就是文本无法换行. 扩展插件 WordWrap 可以实现文本换行         安装方法:    ...

  9. Python随笔目录

    Python 一.Python基础 Python入门 数据类型 函数(迭代器生成器三元表达式) 模块和常用内置模块 面向对象 网络编程(socket) 并发编程 ... 二.数据库 MySQL PyM ...

  10. mybatis三种传值方式

    第一种:按序列传参(dao层的函数方法)[sql] Public User selectUser(String name,String area); 对应的Mapper.xml [sql] <s ...