将Grails部署到云端(Jelastic)Bootstrap问题?

时间:2012-10-23 15:02:19

标签: grails deployment cloud bootstrapping jelastic

我已经创建了一个Grails应用程序,它正在完成之中,我一直在使用各种云提供商进行测试,例如Cloud Foundry,Heroku,App Engine等。最后我去了Jelastic,因为它是似乎完全支持使用本地插件的那个,因为我只需要上传一个“war”文件进行部署。

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

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上运行时,我收到以下错误消息:

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

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

由于

EDIT .....

我也尝试过这个引导数据,显示的错误信息是:S

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 
    } 

我收到的错误消息如下:

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数据并且应用程序启动正常,任何人都可以解释这一点,因为它本地运行正常而不是在云上运行吗?提前致谢

2 个答案:

答案 0 :(得分:1)

我猜您提供的信息不足以帮助您。

为了调试这个,我建议您删除引导代码,以便启动应用程序。

接下来我将安装控制台插件(http://grails.org/plugin/console)。这将允许您在控制台中测试引导代码。也许它可以帮助您追踪问题。

希望有所帮助

答案 1 :(得分:0)

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

相关问题