2012-04-20 54 views
2

我在我的grails應用程序中使用活動插件。當我嘗試運行我的應用程序時,出現此錯誤。表格不會被創建。我不明白爲什麼。Oracle表創建問題

| 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 
+0

這個問題似乎是一個表或視圖中提到的SQL語句不存在,或不能由帳戶被使用來訪問。由於SQL語句未包含在帖子中,我們不知道用戶是什麼參與的,因此目前無法進一步說明什麼。如果你可以編輯你的文章幷包含更多信息,那麼有人可能會更好地猜測發生了什麼。 – 2012-04-20 14:24:18

回答

3

3的可能性浮現在腦海中的此錯誤消息:

  1. 表/視圖被引用的其實並不存在。
  2. 表/視圖被引用的確實存在,但你沒有權限由它來選擇。
  3. 表/視圖存在,則必須從權限它來選擇,但表/視圖是在一個不同的模式,並且不與一個合格的名稱(例如,SCHEMA.TABLE_NAME)引用或經由一個同義詞不混疊。

修復的問題應該是相當明顯的:

  1. 通過GRANT命令
  2. 獲取權限表/視圖中創建表/視圖中創建一個同義詞或完全限定您的SELECT語句中的表/視圖名稱
+0

1.被引用的表/視圖實際上不存在。 但我不想手動創建這些表格,因爲它必須自動創建。 – emilan 2012-04-23 05:21:58

+0

那麼這個自動錶創建是由Grails提供的?我不知道Oracle會爲你做這件事。 – DCookie 2012-04-23 13:31:19

0

我剛剛在我的Grails項目中遇到了相同的症狀。

我加入了新的日期變量和格式根本不存在一個默認值造成的錯誤。

是爲我工作後的面向對象版本失敗日期格式爲:

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

你可能有一個不同的錯誤,但問題是,創建表的語句失敗,可能是由於某些方面的數據庫交互,這有點「偏離了路徑」並且最近增加了。

要解決問題,我會採取以下步驟:

1)驗證您與DataSource.groovy中的配置,你以爲你是運行(如更改密碼,並確保你沒有登錄。 ),並且你的dbCreate變量被設置爲「create」或「create-drop」。如果有充分的理由使用更新或驗證,則可以在不同的env中創建相同的對象並移動,或者只是適當地創建表格。如果您不確定,請在新項目的一開始使用create-drop來使用這些工具,然後再次使用。

2)當你已經驗證的Grails應該創建如上表,然後打開日誌,看看有什麼是重新啓動過程中實際發生的事情。爲此,請在您的數據源配置中將「logSql = true」和「formatSql」= true添加到與用戶名和密碼相同的級別。你應該看到你的標準中有缺陷的陳述。

3)如果你不能看到什麼,立刻是錯的,那麼在sqlplus直接運行該語句以隔離有問題的原因。這可能會指向最近的變化。