Grails - Bootstrapping测试数据失败

时间:2012-03-26 19:33:52

标签: mysql grails bootstrapping

我遇到一个奇怪的错误,我不知道如何解决它。我正在Bootstrap.groovy中创建测试实体:

def init = { servletContext ->


    if (Environment.current != Environment.TEST) {
        servletContext.reloadId = new Date().getTime()  // for reloading css

        // create some insurance companies
        InsuranceCompany ozp = InsuranceCompany.findOrSaveWhere(code: "207", acronym: "OZP", name: "Oborová zdravotní pojišťovna zaměstnanců bank, pojišťoven a stavebnictví")
        InsuranceCompany vzp = InsuranceCompany.findOrSaveWhere(code: "111", acronym: "VZP", name: "Všeobecná zdravotní pojišťovna České republiky")
        InsuranceCompany vozp = InsuranceCompany.findOrSaveWhere(code: "201", acronym: "VOZP", name: "Vojenská zdravotní pojišťovna České republiky")
        Patient miladavrana = Patient.findOrSaveWhere(title: "JUDr", firstName: "Milada", lastName: "Vraná", RC: "0307080846", insuranceCompany: vozp,address: new Address(street: "5.Května", number: 568, city: "Korouhev", PSC: 16422))
        Patient jiristarecek = Patient.findOrSaveWhere(title: "", firstName: "Jiří", lastName: "Stareček", RC: "9457174705", insuranceCompany: cpzp,address: new Address(street: "Nad Schody", number: 180, city: "Velký Valtinov", PSC: 51521))
}

实际上,bootstrap文件相当长,它有近1000行测试数据。如果我评论这些数据的2/3,一切正常。当我将所有这些数据取消注释并且grails正在尝试创建它时,它会失败:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000000262b036, pid=4152, tid=8016
#
# JRE version: 6.0_29-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.4-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# j  BootStrap$_closure1.doCall(Ljava/lang/Object;)Ljava/lang/Object;+87
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x000000000d985800):  JavaThread "pool-7-thread-1" [_thread_in_Java, id=8016, stack(0x000000000bcf0000,0x000000000bdf0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000138c797cf

Registers:
RAX=0x000000000bdedd78, RBX=0x000000000bdedd78, RCX=0x00000000d9d1e488, RDX=0x00000000d9d0abff
RSP=0x000000000bdedd88, RBP=0x000000000bdeddb8, RSI=0x000000000d985800, RDI=0x000000000ee83ed0
R8 =0x0000000000000004, R9 =0x00000000d4b4e890, R10=0x000000006dfc4f80, R11=0x000000000ee83f38
R12=0x0000000000000000, R13=0x00000000d9d1d8ce, R14=0x000000000bdee5b0, R15=0x000000000d985800
RIP=0x000000000262b036, EFLAGS=0x0000000000010287

这是错误生成的日志的一部分。我正在使用Grails 2.0.1& MySQL 5.5.21作为数据库。以前任何人都可以解决这个错误吗?非常感谢你。

干杯, Lojza

1 个答案:

答案 0 :(得分:0)

尝试通过JAVAOPTS增加对JVM的堆分配。