2

我在我的 grails 应用程序中使用活动插件。当我尝试运行我的应用程序时,我收到了这个错误。不创建表。我不明白为什么。

| Error 2012-04-20 18:30:24,746 [pool-6-thread-1] ERROR interceptor.CommandContext  - Error while closing command context
Message: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

    Line | Method
->>    8 | wrapException                             in org.apache.ibatis.exceptions.ExceptionFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     77 | selectList                                in org.apache.ibatis.session.defaults.DefaultSqlSession
|     69 | selectList . . . . . . . . . . . . . . .  in     ''
|     40 | selectOne                                 in     ''
|    217 | selectById . . . . . . . . . . . . . . .  in org.activiti.engine.impl.db.DbSqlSession
|    629 | dbSchemaUpdate                            in     ''
|    885 | performSchemaOperationsProcessEngineBuild in     ''
|     25 | execute                                   in org.activiti.engine.impl.SchemaOperationsProcessEngineBuild
|     24 | execute . . . . . . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.CommandExecutorImpl
|     42 | execute                                   in org.activiti.engine.impl.interceptor.CommandContextInterceptor
|     40 | execute . . . . . . . . . . . . . . . . . in org.activiti.spring.SpringTransactionInterceptor
|     33 | execute                                   in org.activiti.engine.impl.interceptor.LogInterceptor
|     77 | <init> . . . . . . . . . . . . . . . . .  in org.activiti.engine.impl.ProcessEngineImpl
|    271 | buildProcessEngine                        in org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
|     60 | buildProcessEngine . . . . . . . . . . .  in org.activiti.spring.SpringProcessEngineConfiguration
|     56 | getObject                                 in org.activiti.spring.ProcessEngineFactoryBean
|     32 | getObject . . . . . . . . . . . . . . . . in     ''
|    334 | innerRun                                  in java.util.concurrent.FutureTask$Sync
|    166 | run . . . . . . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
|   1110 | runWorker                                 in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                                       in java.lang.Thread

Caused by SQLSyntaxErrorException: ORA-00942: table or view does not exist

->>   91 | newSQLException                           in oracle.jdbc.driver.SQLStateMapping
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    112 | newSQLException                           in oracle.jdbc.driver.DatabaseError
|    173 | throwSqlException . . . . . . . . . . . . in     ''
|    455 | processError                              in oracle.jdbc.driver.T4CTTIoer
|    413 | processError . . . . . . . . . . . . . .  in     ''
|   1030 | receive                                   in oracle.jdbc.driver.T4C8Oall
|    194 | doOall8 . . . . . . . . . . . . . . . . . in oracle.jdbc.driver.T4CPreparedStatement
|    785 | executeForDescribe                        in     ''
|    860 | executeMaybeDescribe . . . . . . . . . .  in     ''
|   1186 | doExecuteWithTimeout                      in oracle.jdbc.driver.OracleStatement
|   3381 | executeInternal . . . . . . . . . . . . . in oracle.jdbc.driver.OraclePreparedStatement
|   3482 | execute                                   in     ''
|   1373 | execute . . . . . . . . . . . . . . . . . in oracle.jdbc.driver.OraclePreparedStatementWrapper
|    172 | execute                                   in org.apache.commons.dbcp.DelegatingPreparedStatement
|     39 | query . . . . . . . . . . . . . . . . . . in org.apache.ibatis.executor.statement.PreparedStatementHandler
|     55 | query                                     in org.apache.ibatis.executor.statement.RoutingStatementHandler
|     41 | doQuery . . . . . . . . . . . . . . . . . in org.apache.ibatis.executor.SimpleExecutor
|    216 | queryFromDatabase                         in org.apache.ibatis.executor.BaseExecutor
|     95 | query . . . . . . . . . . . . . . . . . . in     ''
|     72 | query                                     in org.apache.ibatis.executor.CachingExecutor
|     75 | selectList . . . . . . . . . . . . . . .  in org.apache.ibatis.session.defaults.DefaultSqlSession
|     69 | selectList                                in     ''
|     40 | selectOne . . . . . . . . . . . . . . . . in     ''
|    217 | selectById                                in org.activiti.engine.impl.db.DbSqlSession
|    629 | dbSchemaUpdate . . . . . . . . . . . . .  in     ''
|    885 | performSchemaOperationsProcessEngineBuild in     ''
|     25 | execute . . . . . . . . . . . . . . . . . in org.activiti.engine.impl.SchemaOperationsProcessEngineBuild
|     24 | execute                                   in org.activiti.engine.impl.interceptor.CommandExecutorImpl
|     42 | execute . . . . . . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.CommandContextInterceptor
|     40 | execute                                   in org.activiti.spring.SpringTransactionInterceptor
|     33 | execute . . . . . . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.LogInterceptor
|     77 | <init>                                    in org.activiti.engine.impl.ProcessEngineImpl
|    271 | buildProcessEngine . . . . . . . . . . .  in org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
|     60 | buildProcessEngine                        in org.activiti.spring.SpringProcessEngineConfiguration
|     56 | getObject . . . . . . . . . . . . . . . . in org.activiti.spring.ProcessEngineFactoryBean
|     32 | getObject                                 in     ''
|    334 | innerRun . . . . . . . . . . . . . . . .  in java.util.concurrent.FutureTask$Sync
|    166 | run                                       in java.util.concurrent.FutureTask
|   1110 | runWorker . . . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    603 | run                                       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . . . . . . . . . . . . . . in java.lang.Thread
| Error 2012-04-20 18:30:24,927 [pool-6-thread-1] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

Message: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread

Caused by PersistenceException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

->>    8 | wrapException in org.apache.ibatis.exceptions.ExceptionFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     77 | selectList in org.apache.ibatis.session.defaults.DefaultSqlSession
|     69 | selectList in     ''
|     40 | selectOne in     ''
|    217 | selectById in org.activiti.engine.impl.db.DbSqlSession
|    629 | dbSchemaUpdate in     ''
|    885 | performSchemaOperationsProcessEngineBuild in     ''
|     25 | execute   in org.activiti.engine.impl.SchemaOperationsProcessEngineBuild
|     24 | execute . in org.activiti.engine.impl.interceptor.CommandExecutorImpl
|     42 | execute   in org.activiti.engine.impl.interceptor.CommandContextInterceptor
|     40 | execute . in org.activiti.spring.SpringTransactionInterceptor
|     33 | execute   in org.activiti.engine.impl.interceptor.LogInterceptor
|     77 | <init> .  in org.activiti.engine.impl.ProcessEngineImpl
|    271 | buildProcessEngine in org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
|     60 | buildProcessEngine in org.activiti.spring.SpringProcessEngineConfiguration
|     56 | getObject in org.activiti.spring.ProcessEngineFactoryBean
|     32 | getObject in     ''
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run . . . in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run       in java.lang.Thread

Caused by SQLSyntaxErrorException: ORA-00942: table or view does not exist

->>   91 | newSQLException in oracle.jdbc.driver.SQLStateMapping
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    112 | newSQLException in oracle.jdbc.driver.DatabaseError
|    173 | throwSqlException in     ''
|    455 | processError in oracle.jdbc.driver.T4CTTIoer
|    413 | processError in     ''
|   1030 | receive   in oracle.jdbc.driver.T4C8Oall
|    194 | doOall8 . in oracle.jdbc.driver.T4CPreparedStatement
|    785 | executeForDescribe in     ''
|    860 | executeMaybeDescribe in     ''
|   1186 | doExecuteWithTimeout in oracle.jdbc.driver.OracleStatement
|   3381 | executeInternal in oracle.jdbc.driver.OraclePreparedStatement
|   3482 | execute   in     ''
|   1373 | execute . in oracle.jdbc.driver.OraclePreparedStatementWrapper
|    172 | execute   in org.apache.commons.dbcp.DelegatingPreparedStatement
|     39 | query . . in org.apache.ibatis.executor.statement.PreparedStatementHandler
|     55 | query     in org.apache.ibatis.executor.statement.RoutingStatementHandler
|     41 | doQuery . in org.apache.ibatis.executor.SimpleExecutor
|    216 | queryFromDatabase in org.apache.ibatis.executor.BaseExecutor
|     95 | query . . in     ''
|     72 | query     in org.apache.ibatis.executor.CachingExecutor
|     75 | selectList in org.apache.ibatis.session.defaults.DefaultSqlSession
|     69 | selectList in     ''
|     40 | selectOne in     ''
|    217 | selectById in org.activiti.engine.impl.db.DbSqlSession
|    629 | dbSchemaUpdate in     ''
|    885 | performSchemaOperationsProcessEngineBuild in     ''
|     25 | execute . in org.activiti.engine.impl.SchemaOperationsProcessEngineBuild
|     24 | execute   in org.activiti.engine.impl.interceptor.CommandExecutorImpl
|     42 | execute . in org.activiti.engine.impl.interceptor.CommandContextInterceptor
|     40 | execute   in org.activiti.spring.SpringTransactionInterceptor
|     33 | execute . in org.activiti.engine.impl.interceptor.LogInterceptor
|     77 | <init>    in org.activiti.engine.impl.ProcessEngineImpl
|    271 | buildProcessEngine in org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
|     60 | buildProcessEngine in org.activiti.spring.SpringProcessEngineConfiguration
|     56 | getObject in org.activiti.spring.ProcessEngineFactoryBean
|     32 | getObject in     ''
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
4

2 回答 2

3

想到此错误消息的 3 种可能性:

  1. 被引用的表/视图实际上不存在。
  2. 被引用的表/视图确实存在,但您无权从中选择。
  3. 表/视图存在,您有权从中选择,但表/视图位于不同的模式中,并且没有使用限定名称(例如,SCHEMA.TABLE_NAME)引用,或者没有通过同义词进行别名。

该问题的修复应该相当明显:

  1. 创建表/视图
  2. 通过 GRANT 命令获取表/视图的权限
  3. 在 SELECT 语句中创建同义词或完全限定表/视图名称
于 2012-04-20T15:43:09.147 回答
0

我刚刚在我的 Grails 项目中遇到了同样的症状。

我通过添加一个新的日期变量和一个不存在的格式的默认值导致了错误。

在面向对象版本失败后对我有用的日期格式是:

static mapping = {
    myVar defaultValue: "'01-JAN-1970'"
}

您可能有一个不同的错误,但关键是 create table 语句失败,可能是由于数据库交互的某些方面有点“不走寻常路”,并且是最近添加的。

为了排除故障,我将采取以下步骤:

1) 验证您正在使用您认为的 DataSource.groovy 配置运行(例如,更改您的密码并确保您无法登录)并且您的 dbCreate 变量设置为“create”或“create-drop”作为适当的。如果有充分的理由使用更新或验证,那么要么在不同的环境中创建相同的对象并移动,要么只是适当地创建表。如果您不确定,请在新项目的一开始就使用 create-drop 来使用这些工具,然后再也不使用了。

2) 当您确认 grails 应该像上面那样创建表时,然后打开日志记录以查看重新启动期间实际发生的情况。为此,请将“logSql = true”和“formatSql” = true 添加到与用户名和密码相同级别的数据源配置中。您应该在标准输出中看到有缺陷的 create 语句。

3)如果你不能立即看到什么问题,那么直接在sqlplus中运行语句来隔离出问题的原因。这可能会指向最近的变化。

于 2013-10-15T06:20:51.987 回答