首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Deploying Grails to the cloud (Jelastic) Bootstrap问题?

Deploying Grails to the cloud (Jelastic) Bootstrap问题?
EN

Stack Overflow用户
提问于 2012-10-23 23:02:19
回答 2查看 355关注 0票数 1

我已经创建了一个Grails应用程序,它即将完成,我已经使用各种云提供商对其进行了测试,例如Cloud Foundry、Heroku、App Engine等。最后,我选择了Jelastic,因为它似乎完全支持本地插件的使用,因为我只需要上传一个"war“文件进行部署。

到今天为止,我对此没有任何问题,一切都很好,但是我做了一些更改,并在我的应用程序中添加了一些关系,然后我使用BootStrap填充这些关系。这个Bootstrap以前是有效的,但是现在它已经停止了,下面你可以看到my Bootstrap的一个例子:

代码语言:javascript
复制
def init = { servletContext ->

def adminRole = new SecRole(authority: 'ADMIN').save(flush: true) 
def userRole = new SecRole(authority: 'USER').save(flush: true)

def Admin = new SecUser(username: 'admin', email:'admin@admin.com', enabled: true, password: 'password')

def SuperUser = new Areas(name:"SuperUser")
.addToUsers(Admin)
.save(flush:true)

SecUserSecRole.create Admin, adminRole, true

assert SecUser.count() == 1 
assert SecRole.count() == 2 
assert SecUserSecRole.count() == 1 
    } 

当我使用这些数据在本地运行应用程序时,BootStrap运行得很好,但是当我在Jelastic上运行它时,我得到了以下错误消息:

代码语言:javascript
复制
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL

这只是错误发生位置的部分堆栈跟踪,但我不知道为什么会发生,有人能帮忙吗?

谢谢

编辑.....

我还尝试了此引导数据库数据,但显示了相同的错误消息:S

代码语言:javascript
复制
def init = { servletContext ->

def adminRole = new SecRole(authority: 'ADMIN').save(flush: true) 

def SuperAdmin = new Areas(name: 'Super Admin')

SuperAdmin.save(flush: true)

def area = Areas.findByName('SuperAdmin')

def SuperAdmin = new SecUser(username: 'admin', email:'test@test.com', area: area, enabled: true, password: 'admin')

SuperAdmin.save()

SecUserSecRole.create SuperAdmin, adminRole, true

assert SecUser.count() == 1 
assert SecRole.count() == 2 
assert SecUserSecRole.count() == 1 
    } 

我收到的错误消息如下:

代码语言:javascript
复制
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [select this_.id as id3_0_, this_.version as version3_0_, this_.account_expired as account3_3_0_, this_.account_locked as account4_3_0_, this_.area_id as area5_3_0_, this_.email as email3_0_, this_.enabled as enabled3_0_, this_."password" as password8_3_0_, this_.password_expired as password9_3_0_, this_.username as username3_0_ from sec_user this_ where this_.username=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query

我已经剔除了BootStrap数据,应用程序启动得很好,有没有人能说明这一点,因为它在本地运行得很好,只是不能在云上运行?提前感谢

EN

回答 2

Stack Overflow用户

发布于 2012-11-15 04:56:57

我想你提供的信息不足以帮助你。

为了调试它,我建议您删除bootstrap代码,以便您的应用程序能够启动。

接下来,我将安装控制台插件(http://grails.org/plugin/console)。这将允许您在控制台中测试引导程序代码。也许它能帮助你找到问题所在。

希望这能有所帮助

票数 1
EN

Stack Overflow用户

发布于 2012-11-15 17:22:03

您在本地是否使用与在Jelastic云中相同的环境拓扑?您能提供您的Jelastic环境名称吗?此外,请确保您的Jelastic安装不会遗漏DB连接库,并且版本与您在本地使用的版本相同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13033456

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档