0

我正在导入一个现有的 grails 项目,这个项目使用 postgresql 使用远程 postgresql,他们在真机上构建它,现在我需要在我的 localhost 机器上执行它,并在本地使用 postgresql。

一切正常,但是系统可以使用postgresql,虽然我在datasource.config中设置了它。我的 datasource.config 类似于旧的真实配置,只是在远程服务器和本地服务器之间进行了一些更改。这是我的datasource.config。

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 {
    production {
    pooled = true
    driverClassName = "org.postgresql.Driver"
    username = "postgres"
    password = "postgres"
    dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate'
    url = "jdbc:postgresql://localhost:5432/faql_dev"
    }
}

这是我得到的一些错误:

Caused by: org.compass.gps.device.hibernate.HibernateGpsDeviceException: {hibernate}: Failed to index the database; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query using scroll
at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:172)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:102)
... 5 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
    at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:118)
    ... 10 more
Caused by: org.h2.jdbc.JdbcSQLException: Table "QUESTION" not found; SQL statement:

我将所有涉及的内容都导入了postgresql,所以我可以在开发模式下基于域创建表,但我无法运行它。在生产中,它会抛出该异常。

提前致谢!

4

1 回答 1

2
Caused by: org.h2.jdbc.JdbcSQLException

这表明您使用了错误的 JDBC 驱动程序。您发布的数据源配置仅将应用程序设置为在生产模式下使用 Postgres,如果您在本地以开发模式运行,那么它将使用默认的 H2 数据库。

于 2013-08-06T08:52:57.603 回答