我正在使用 Grails 2.2.0 和 MongoDB。我已将 Grails 配置为针对 MongoDB 而不是内存数据库中的默认 H2 运行。尽管我认为我删除了它,但似乎涉及到错误消息 h2。
我的 DataSource.groovy:
grails {
mongo {
host = "localhost"
port = 27017
databaseName = "physicians"
}
}
我的 BuildConfig.groovy:
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.8.0"
runtime ":resources:1.1.6"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.4"
build ":tomcat:$grailsVersion"
runtime ":database-migration:1.1"
compile ':cache:1.0.0'
compile ':mongodb:1.1.0.GA'
}
当我想保存域对象 Artist 时出现的错误是:
| Error 2013-01-03 22:33:18,881 [http-bio-9090-exec-1] ERROR util.JDBCExceptionReporter - Table "ARTIST" not found; SQL statement:
insert into artist (id, version, artist_name, birth_name) values (null, ?, ?, ?) [42102-164]
| Error 2013-01-03 22:33:19,050 [http-bio-9090-exec-1] ERROR errors.GrailsExceptionResolver - JdbcSQLException occurred when processing request: [GET] /musicstack/artist/
Table "ARTIST" not found; SQL statement:
insert into artist (id, version, artist_name, birth_name) values (null, ?, ?, ?) [42102-164]. Stacktrace follows:
Message: Table "ARTIST" not found; SQL statement:
insert into artist (id, version, artist_name, birth_name) values (null, ?, ?, ?) [42102-164]
Line | Method
->> 329 | getJdbcSQLException in org.h2.message.DbException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 169 | get in ''
| 146 | get . . . . . . . . in ''
| 4753 | readTableOrView in org.h2.command.Parser
| 4731 | readTableOrView . . in ''
| 954 | parseInsert in ''
| 375 | parsePrepared . . . in ''
| 279 | parse in ''
| 251 | parse . . . . . . . in ''
| 217 | prepareCommand in ''
| 415 | prepareLocal . . . in org.h2.engine.Session
| 364 | prepareCommand in ''
| 1121 | prepareCommand . . in org.h2.jdbc.JdbcConnection
| 71 | <init> in org.h2.jdbc.JdbcPreparedStatement
| 267 | prepareStatement . in org.h2.jdbc.JdbcConnection
| 1051 | prepareStatement in ''
| 508 | prepareStatement . in org.apache.commons.dbcp.DelegatingConnection
| 400 | prepareStatement in org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
| 7 | index . . . . . . . in musicstack.ArtistController
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . . . . . . . in ''
^ 680 | run in java.lang.Thread
我在这里想念什么?
最好的问候/Lasse
=====================================
得到它的工作。
首先我必须删除线
runtime ":hibernate:$grailsVersion"
来自 BuildConfig.groovy
当我这样做时,我得到了这个:
| Error Fatal error during compilation org.apache.tools.ant.BuildException:
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
(NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
然后我删除了这条线
runtime ":database-migration:1.1"
来自 BuildConfig.groovy
搜索解决此问题时未找到最后一部分。这是它应该做的方式吗?
/拉斯