Grails:尝试使用Oracle 11g XE进行配置时出错

时间:2013-05-04 19:19:53

标签: grails oracle11g

我在本地安装了Oracle 11g XE(快速版)实例。我想把它作为我所有环境的Grails DB。 我有Oracle用户的用户名/密码,我在这里有ojdbc6.jar文件:

\ myAppName \ lib中\ ojdbc6.jar

我还没有在数据库中创建任何表 - 我假设Grails足够聪明,可以根据需要创建表,但如果没有,那显然可能是个问题......

这是我的DataSource.groovy文件内容:

dataSource {
    //ORACLE
    dbCreate = "create-drop"
    url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"
    pooled = true
    username = "mills_gtunes"
    password = "*******"
    driverClassName = "oracle.jdbc.driver.OracleDriver"
    //          dialect= "org.hibernate.dialect.Oracle10gDialect"
    dialect= "org.hibernate.dialect.OracleDialect"

    properties {
        maxActive = -1
        minEvictableIdleTimeMillis=1800000
        timeBetweenEvictionRunsMillis=1800000
        numTestsPerEvictionRun=3
        testOnBorrow=true
        testWhileIdle=true
        testOnReturn=true
        validationQuery="SELECT 1"
    }
}


hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
    development {
        dataSource {

            //H2
            //  dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            //  url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"

            //ORACLE
            dbCreate = "create-drop"
            url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"
            pooled = true
            username = "mills_gtunes"
            password = "******"
            driverClassName = "oracle.jdbc.driver.OracleDriver"
            dialect= "org.hibernate.dialect.OracleDialect"

            properties {
                maxActive = -1
                minEvictableIdleTimeMillis=1800000
                timeBetweenEvictionRunsMillis=1800000
                numTestsPerEvictionRun=3
                testOnBorrow=true
                testWhileIdle=true
                testOnReturn=true
                validationQuery="SELECT 1"
            }
        }
    }

以下是从Windows命令行运行“grails run-app”后出现的错误:

->>   91 | newSQLException in oracle.jdbc.driver.SQLStateMapping
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    133 | newSQLException in oracle.jdbc.driver.DatabaseError
|    206 | throwSqlException in     ''
|    455 | processError in oracle.jdbc.driver.T4CTTIoer
|    413 | processError in     ''
|   1034 | receive   in oracle.jdbc.driver.T4C8Oall
|    183 | doOall8 . in oracle.jdbc.driver.T4CStatement
|    780 | executeForDescribe in     ''
|    855 | executeMaybeDescribe in     ''
|   1186 | doExecuteWithTimeout in oracle.jdbc.driver.OracleStatement
|   1377 | executeQuery in     ''
|    387 | executeQuery in oracle.jdbc.driver.OracleStatementWrapper
|    208 | executeQuery in org.apache.commons.dbcp.DelegatingStatement
|    658 | validateConnection in org.apache.commons.dbcp.PoolableConnectionFacto
ry
|   1558 | validateConnectionFactory in org.apache.commons.dbcp.BasicDataSource
|   1545 | createPoolableConnectionFactory in     ''
|   1388 | createDataSource in     ''
|   1044 | getConnection 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 2013-05-04 14:47:22,691 [localhost-startStop-1] ERROR context.GrailsCont
extLoader  - Error initializing Grails: Error creating bean with name 'transacti
onManagerPostProcessor': Initialization of bean failed; nested exception is org.
springframework.beans.factory.BeanCreationException: Error creating bean with na
me 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while
 setting bean property 'sessionFactory'; nested exception is org.springframework
.beans.factory.BeanCreationException: Error creating bean with name 'sessionFact
ory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean p
roperty 'lobHandler'; nested exception is org.springframework.beans.factory.Bean
CreationException: Error creating bean with name 'lobHandlerDetector': Invocatio
n of init method failed; nested exception is org.springframework.jdbc.support.Me
taDataAccessException: Error while extracting DatabaseMetaData; nested exception
 is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnection
Factory (ORA-00923: FROM keyword not found where expected
)
Message: Error creating bean with name 'transactionManagerPostProcessor': Initia
lization of bean failed; nested exception is org.springframework.beans.factory.B
eanCreationException: Error creating bean with name 'transactionManager': Cannot
 resolve reference to bean 'sessionFactory' while setting bean property 'session
Factory'; nested exception is org.springframework.beans.factory.BeanCreationExce
ption: Error creating bean with name 'sessionFactory': Cannot resolve reference
to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested ex
ception is org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'lobHandlerDetector': Invocation of init method failed; nested
 exception is org.springframework.jdbc.support.MetaDataAccessException: Error wh
ile extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQL
NestedException: Cannot create PoolableConnectionFactory (ORA-00923: FROM keywor
d not found where expected
)
    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 BeanCreationException: Error creating bean with name 'transactionManag
er': Cannot resolve reference to bean 'sessionFactory' while setting bean proper
ty 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanC
reationException: Error creating bean with name 'sessionFactory': Cannot resolve
 reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'
; nested exception is org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'lobHandlerDetector': Invocation of init method fai
led; nested exception is org.springframework.jdbc.support.MetaDataAccessExceptio
n: Error while extracting DatabaseMetaData; nested exception is org.apache.commo
ns.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00923:
FROM keyword not found where expected
)
->>  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 BeanCreationException: Error creating bean with name 'sessionFactory':
 Cannot resolve reference to bean 'lobHandlerDetector' while setting bean proper
ty 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreat
ionException: Error creating bean with name 'lobHandlerDetector': Invocation of
init method failed; nested exception is org.springframework.jdbc.support.MetaDat
aAccessException: Error while extracting DatabaseMetaData; nested exception is o
rg.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFacto
ry (ORA-00923: FROM keyword not found where expected
)
->>  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 BeanCreationException: Error creating bean with name 'lobHandlerDetect
or': Invocation of init method failed; nested exception is org.springframework.j
dbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; ne
sted exception is org.apache.commons.dbcp.SQLNestedException: Cannot create Pool
ableConnectionFactory (ORA-00923: FROM keyword not found where expected
)
->>  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 MetaDataAccessException: Error while extracting DatabaseMetaData; nest
ed exception is org.apache.commons.dbcp.SQLNestedException: Cannot create Poolab
leConnectionFactory (ORA-00923: FROM keyword not found where expected
)
->>  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 SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00923
: FROM keyword not found where expected
)
->> 1549 | createPoolableConnectionFactory in org.apache.commons.dbcp.BasicDataS
ource
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   1388 | createDataSource in     ''
|   1044 | getConnection 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-00923: FROM keyword not found where expec
ted

->>   91 | newSQLException in oracle.jdbc.driver.SQLStateMapping
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    133 | newSQLException in oracle.jdbc.driver.DatabaseError
|    206 | throwSqlException in     ''
|    455 | processError in oracle.jdbc.driver.T4CTTIoer
|    413 | processError in     ''
|   1034 | receive   in oracle.jdbc.driver.T4C8Oall
|    183 | doOall8 . in oracle.jdbc.driver.T4CStatement
|    780 | executeForDescribe in     ''
|    855 | executeMaybeDescribe in     ''
|   1186 | doExecuteWithTimeout in oracle.jdbc.driver.OracleStatement
|   1377 | executeQuery in     ''
|    387 | executeQuery in oracle.jdbc.driver.OracleStatementWrapper
|    208 | executeQuery in org.apache.commons.dbcp.DelegatingStatement
|    658 | validateConnection in org.apache.commons.dbcp.PoolableConnectionFacto
ry
|   1558 | validateConnectionFactory in org.apache.commons.dbcp.BasicDataSource
|   1545 | createPoolableConnectionFactory in     ''
|   1388 | createDataSource in     ''
|   1044 | getConnection 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 2013-05-04 14:47:22,729 [localhost-startStop-1] ERROR [localhost].[/gTun
es]  - Exception sending context initialized event to listener instance of class
 org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
Message: Error creating bean with name 'transactionManagerPostProcessor': Initia
lization of bean failed; nested exception is org.springframework.beans.factory.B
eanCreationException: Error creating bean with name 'transactionManager': Cannot
 resolve reference to bean 'sessionFactory' while setting bean property 'session
Factory'; nested exception is org.springframework.beans.factory.BeanCreationExce
ption: Error creating bean with name 'sessionFactory': Cannot resolve reference
to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested ex
ception is org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'lobHandlerDetector': Invocation of init method failed; nested
 exception is org.springframework.jdbc.support.MetaDataAccessException: Error wh
ile extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQL
NestedException: Cannot create PoolableConnectionFactory (ORA-00923: FROM keywor
d not found where expected
)
    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 BeanCreationException: Error creating bean with name 'transactionManag
er': Cannot resolve reference to bean 'sessionFactory' while setting bean proper
ty 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanC
reationException: Error creating bean with name 'sessionFactory': Cannot resolve
 reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'
; nested exception is org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'lobHandlerDetector': Invocation of init method fai
led; nested exception is org.springframework.jdbc.support.MetaDataAccessExceptio
n: Error while extracting DatabaseMetaData; nested exception is org.apache.commo
ns.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00923:
FROM keyword not found where expected
)
->>  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 BeanCreationException: Error creating bean with name 'sessionFactory':
 Cannot resolve reference to bean 'lobHandlerDetector' while setting bean proper
ty 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreat
ionException: Error creating bean with name 'lobHandlerDetector': Invocation of
init method failed; nested exception is org.springframework.jdbc.support.MetaDat
aAccessException: Error while extracting DatabaseMetaData; nested exception is o
rg.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFacto
ry (ORA-00923: FROM keyword not found where expected
)
->>  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 BeanCreationException: Error creating bean with name 'lobHandlerDetect
or': Invocation of init method failed; nested exception is org.springframework.j
dbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; ne
sted exception is org.apache.commons.dbcp.SQLNestedException: Cannot create Pool
ableConnectionFactory (ORA-00923: FROM keyword not found where expected
)
->>  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 MetaDataAccessException: Error while extracting DatabaseMetaData; nest
ed exception is org.apache.commons.dbcp.SQLNestedException: Cannot create Poolab
leConnectionFactory (ORA-00923: FROM keyword not found where expected
)
->>  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 SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00923
: FROM keyword not found where expected
)
->> 1549 | createPoolableConnectionFactory in org.apache.commons.dbcp.BasicDataS
ource
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   1388 | createDataSource in     ''
|   1044 | getConnection 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-00923: FROM keyword not found where expec
ted

->>   91 | newSQLException in oracle.jdbc.driver.SQLStateMapping
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    133 | newSQLException in oracle.jdbc.driver.DatabaseError
|    206 | throwSqlException in     ''
|    455 | processError in oracle.jdbc.driver.T4CTTIoer
|    413 | processError in     ''
|   1034 | receive   in oracle.jdbc.driver.T4C8Oall
|    183 | doOall8 . in oracle.jdbc.driver.T4CStatement
|    780 | executeForDescribe in     ''
|    855 | executeMaybeDescribe in     ''
|   1186 | doExecuteWithTimeout in oracle.jdbc.driver.OracleStatement
|   1377 | executeQuery in     ''
|    387 | executeQuery in oracle.jdbc.driver.OracleStatementWrapper
|    208 | executeQuery in org.apache.commons.dbcp.DelegatingStatement
|    658 | validateConnection in org.apache.commons.dbcp.PoolableConnectionFacto
ry
|   1558 | validateConnectionFactory in org.apache.commons.dbcp.BasicDataSource
|   1545 | createPoolableConnectionFactory in     ''
|   1388 | createDataSource in     ''
|   1044 | getConnection 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 2013-05-04 14:47:22,761 [localhost-startStop-1] ERROR core.StandardConte
xt  - Error listenerStart
| Error 2013-05-04 14:47:22,764 [localhost-startStop-1] ERROR core.StandardConte
xt  - Context [/gTunes] startup failed due to previous errors
| Server running. Browse to http://localhost:8080/gTunes
| Application loaded in interactive mode. Type 'stop-app' to shutdown.

(非常感谢任何见解 - 我是Grails的新手。谢谢。)

1 个答案:

答案 0 :(得分:2)

抱歉,对grails一无所知,但这可能是问题所在:

validationQuery="SELECT 1"

这不是Oracle的有效查询,而您获得的ORA-00923很可能来自于此。

尝试使用此功能(在配置文件中显示的位置替换它):

validationQuery="SELECT 1 from dual"