获取引导Grails错误
虽然一切正常,但我在域中添加了一些静态约束,并删除了数据库并重新创建了它。之后,我将在引导中创建管理员和用户角色,以及演示用户和演示管理员,但我得到一个错误:获取引导Grails错误,grails,groovy,Grails,Groovy,虽然一切正常,但我在域中添加了一些静态约束,并删除了数据库并重新创建了它。之后,我将在引导中创建管理员和用户角色,以及演示用户和演示管理员,但我得到一个错误: | Error 2016-03-31 13:33:21,834 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: null Message: null Line |
| Error 2016-03-31 13:33:21,834 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: null
Message: null
Line | Method
->> 111 | doCall in BootStrap$_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
| 320 | executeForEnvironment . . . . . in ''
| 296 | executeForCurrentEnvironment in ''
| 334 | innerRun . . . . . . . . . . . . in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . . . . . in java.lang.Thread
引导代码:
def init = { servletContext ->
if (!Role.findByAuthority("ROLE_USER")) {
Role role = new Role(authority: 'ROLE_USER')
role.save(failOnError: true)
User user = new User(username: 'testUser', password: 'password1', enabled: true)
UserProfile profile1 = new UserProfile(fullName: "TEST", contactPhone: "8888888888", contactEmail: "test@test.com", displayName: "TEST", invoiceEmail: "test@gmail.com", invoiceDueDate: new Date(), defaultMap: MapType.GOOGLE)
user.profile = profile1
Device device1 = new Device(gpsDateTime: new Date(), vehicleId: "TEST", vehicleModel: "Hundai", imeiNumber: "000000000000000").save(flush: true, failOnError: true)
def test = new Account(notifyEmail: "test@test.com", allowNotify: true, name: 'TEST Car', device: device1).save(flush: true, failOnError: true)
user.addToDevices(device1)
user.save(failOnError: true, flush: true)
UserRole userRole = new UserRole(user: user, role: role)
userRole.save(failOnError: true, flush: true)
}
}
任何帮助都将不胜感激。谢谢。在问题中包含引导代码。否则很难给你一个答案。也要共享你的域类。错误发生在引导程序的第111行,请向我们展示这段代码。错误是在我使用user.save()时出现的,在这一行中,所有内容都被合并成一行?