【发布时间】:2015-06-29 01:08:07
【问题描述】:
我正在尝试在 EC2 上设置 Grails Web 应用程序
实例类型:m3 xlarge
从http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html安装了JAVA
版本: java版本“1.7.0_80” Java(TM) SE 运行时环境 (build 1.7.0_80-b15) Java HotSpot(TM) 64 位服务器 VM(内部版本 24.80-b11,混合模式)
(因为 JAVA 8 存在问题:https://github.com/spring-projects/spring-loaded/issues/98)
从 GVMtools 安装 Grails
grails version : 2.4.3
从
安装 mongoDBhttp://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
有版本 MongoDB 外壳版本:3.0.2 连接到:测试
我的 DataSource.groovy 配置是:
environments {
development {
grails {
mongo {
host = "localhost"
port = 27017
username = "root"
password = "root"
databaseName = "someDatabase"
}
}
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}
我的 Buildconfig.groovy 有最新的 mongo 插件:
compile ":mongodb:3.0.3"
但是在启动服务器之后
grails run-app
并打开任何页面我得到这个
Error:
Stacktrace follows:
Message: null
Line | Method
->> 833 | executeQuery in org.grails.datastore.mapping.mongo.query.MongoQuery
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 542 | list in org.grails.datastore.mapping.query.Query
| 49 | invokeQuery . . in org.grails.datastore.gorm.finders.FindAllByFinder
| 43 | doInSession in org.grails.datastore.gorm.finders.FindAllByFinder$1
| 302 | execute . . . . in org.grails.datastore.mapping.core.DatastoreUtils
| 41 | execute in org.grails.datastore.gorm.finders.AbstractFinder
| 40 | doInvokeInternal in org.grails.datastore.gorm.finders.FindAllByFinder
| 152 | invoke in org.grails.datastore.gorm.finders.DynamicFinder
| 352 | invoke . . . . . in ''
| 105 | methodMissing in org.grails.datastore.gorm.GormStaticApi
| 32 | call . . . . . . in org.grails.datastore.gorm.internal.StaticMethodInvokingClosure
| 49 | function in someDomain
| 25 | listAllResources in in.org.api.APIController
| 16 | index in ''
| 198 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter . . . . in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilte r
| 49 | doFilter in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
745 | run in java.lang.Thread
PS:我也尝试创建用户并对其进行身份验证(Grails - Connect to a MongoDB database using authentication)
使用 db.createUser。
配置可能有什么问题完全相同的配置在我的本地机器上运行良好。
【问题讨论】:
-
这不太可能有帮助,但部署时您不会使用弹簧加载,它仅适用于
run-app。你能用 2.4.5 或 2.5.0 试试吗? -
与 2.4.5 相同的错误
-
您的配置看起来不错。您是否尝试过使用旧版本的 mongo(如
2.6.9)运行您的应用程序。 v3 可能与mongodb:3.0.3存在兼容性问题。 -
是的。 2.6.9 报同样的错误
-
我不确定这是否会对您有所帮助 - 但谷歌搜索将我带到此链接:blog.mongodb.org/post/18510469058/grails-in-the-land-of-mongodb
标签: mongodb grails amazon-ec2