将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. 有线mac 无线MAC 地址&&telnet要先开服务: ipconfig /all getma

    在向IEEE申请到Mac address后,写到Lan设备里,就是Lan Mac,写到Wlan设备里,就是wlan Mac,写到BT设备里,就是BT Mac. MAC(Media Access Con ...

  2. Mysql的with rollup分组统计功能(5.1以上版本)

    RollUp是上卷功能,类似于数据挖掘中的上卷操作. ROLLUp的功能和Order by功能是互斥的. mysql> SELECT year, SUM(profit) FROM sales G ...

  3. [转].Net Windows服务安装完成后自动启动

    本文转自:http://www.cnblogs.com/hb_cattle/archive/2011/12/04/2275319.html 考虑到部署方便,我们一般都会将C#写的Windows服务制作 ...

  4. flash builder注释字体看不清

    window-preferences-flex-editiors-syntex coloring-ActionScript-Comment (窗口-首选项-flashbuilder-编辑器-语法着色- ...

  5. 使用AngularJS 添加行修改、删除表格数据

    https://blog.csdn.net/xin_x1n/article/details/53070144 <html xmlns="http://www.w3.org/1999/x ...

  6. [javaSE] IO流(管道流)

    之前我们使用io流,都是需要一个中间数组,管道流可以直接输入流对接输出流,一般和多线程配合使用,当读取流中没数据时会阻塞当前的线程,对其他线程没有影响 定义一个类Read实现Runable接口,实现r ...

  7. html全局属性(收藏)

    HTML 属性赋予元素意义和语境. 下面的全局属性可用于任何 HTML 元素. 参考链接:http://www.w3school.com.cn/tags/html_ref_standardattrib ...

  8. GString惰性求值

    当对一个GString实例求值时,如果其中包含一个变量,该变量的值会被简单地打印到一个Writer,通常是一个StringWriter.然而,如果GString中包含的是一个闭包,而非变量,该闭包就会 ...

  9. sql: Oracle 11g create table, function,trigger, sequence

    --书藉位置Place目录 drop table BookPlaceList; create table BookPlaceList ( BookPlaceID INT PRIMARY KEY, -- ...

  10. FATAL bad indentation of a mapping entry at line 83, column 3: branch: master 已解决;

    部署hexo 时候,修改完_config.yml  文件后更新报错如下,问题解决: FATAL bad indentation of a mapping entry at line 83, colum ...