flowable 初始化 oracle数据库 表或视图不存在

版权声明:本文为博主原创文章,未经博主允许不得转载。不经过允许copy,讲追究法律责任,欢迎加入我们的学习提升群523988350,可以相互交流 https://blog.csdn.net/qq_30739519/article/details/85639567

在使用flowable 创建初始化oracle数据表,出现如下错误:


org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLException: ORA-00942: 表或视图不存在
### The error may exist in org/flowable/db/mapping/entity/Property.xml
### The error may involve org.flowable.engine.impl.persistence.entity.PropertyEntityImpl.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLException: ORA-00942: 表或视图不存在
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
	at org.flowable.engine.common.impl.db.DbSqlSession.selectById(DbSqlSession.java:237)
	at org.flowable.engine.common.impl.db.DbSqlSession.selectById(DbSqlSession.java:2

初始化配置如下:

ProcessEngineConfiguration pec = new StandaloneProcessEngineConfiguration();
pec.setJdbcDriver("oracle.jdbc.driver.OracleDriver");
pec.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:orcl");
pec.setJdbcUsername("flowable");
pec.setJdbcPassword("flowable");
pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
ProcessEngine processEngine = pec.buildProcessEngine();

可能是以前另一个数据库用户初始化过Flowable数据库表的原因,于是添加Shema配置

pec.setDatabaseSchema("FLOWABLE");
添加配置后,重新启动初始化,又出现了错误,错误信息如下:
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setSchema(Ljava/lang/String;)V
 
	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.apache.ibatis.datasource.pooled.PooledConnection.invoke(PooledConnection.java:245)
	at com.sun.proxy.$Proxy6.setSchema(Unknown Source)
	at org.flowable.engine.common.impl.db.DbSqlSessionFactory.openSession(DbSqlSessionFactory.java:78)
	at org.flowable.engine.common.impl.interceptor.CommandContext.getSession(CommandContext.java:243)
	at org.flowable.engine.common.impl.cfg.standalone.StandaloneMybatisTransactionContext.<init>(StandaloneMybatisTransactionContext.java:48)
	at org.flowable.engine.common.impl.cfg.standalone.StandaloneMybatisTransactionContextFactory.openTransactionContext(StandaloneMybatisTransactionContextFactory.java:26)
	at org.flowable.engine.common.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:47)
	at org.flowable.engine.common.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
	at org.flowable.engine.common.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:35)
	at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
	at org.flowable.idm.engine.impl.IdmEngineImpl.<init>(IdmEngineImpl.java:45)
	at org.flowable.idm.engine.IdmEngineConfiguration.buildIdmEngine(IdmEngineConfiguration.java:171)
	at org.flowable.engine.impl.cfg.IdmEngineConfigurator.configure(IdmEngineConfigurator.java:76)
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.configuratorsAfterInit(ProcessEngineConfigurationImpl.java:1375)
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:865)
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:779)
	at com.smart.HolidayTest.engineTest(HolidayTest.java:26)
	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	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

解决办法:

去掉schema配置,设置一个表前缀

ProcessEngineConfiguration pec = new StandaloneProcessEngineConfiguration();
        pec.setJdbcDriver("oracle.jdbc.driver.OracleDriver");
        pec.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:orcl");
        pec.setJdbcUsername("flowable");
        pec.setJdbcPassword("flowable");
 
        pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
 
        //pec.setDatabaseSchema("FLOWABLE");
        pec.setDatabaseTablePrefix("flow");
        ProcessEngine processEngine = pec.buildProcessEngine();

再执行自动建表,发现所有表和序列都已经创建成功。

然后就可以愉快地玩耍了。

猜你喜欢

转载自blog.csdn.net/qq_30739519/article/details/85639567