Announcement Announcement Module
Collapse
No announcement yet.
Bootstrapping test data fails Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstrapping test data fails

    Hello,
    I'm encounter a strange error and I don't know how to fix it. I'm creating test entities in Bootstrap.groovy:
    Code:
    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))
    }
    Actually the bootstrap file is quite longer, it has almost 1000 lines of test data. Everything works ok if I comment 2/3 of those data. When I have all of these data uncomment and grails is trying to create it, it fails:
    Code:
    #
    # 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
    this is part of the log the error generates. I'm using Grails 2.0.1 & MySQL 5.5.21 as a database. Anyone could hep or has this error before? Thank you very much.

    Cheers,
    Lojza

  • #2
    Nevermind, I got the answer from StackOverflow. The solution is to divide the init process into smaller transactions with "withTransaction".

    Comment

    Working...
    X