Grails
  1. Grails
  2. GRAILS-7870

Cannot create subclasses during BootStrap

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-M1
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
    • Environment:
      Reproduced on both Mandriva Linux (Java 1.6) and Windows XP (Java 1.6)

      Description

      Create domains classes as follows:
      =================================
      abstract class A {

      String name

      static constraints =

      { name blank:false, unique:true, maxSize:25 , matches: '^[A-Z_0-9]+$', nullable:false }

      static mapping =

      { tablePerHierarchy false }

      def isSystem =

      { false; }

      }

      class B extends A {

      boolean abc = false

      def isSystem =

      { true; }

      }

      Add to BootStrap.groovy:
      =======================
      def ss= new B( name : 'UNCONFIRMED', abc:true )

      When running 'grails test-app integration' this stacktrace is produced:
      =======================================================================

      Error Error executing script TestApp: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.kroovyban.SystemState': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionManager' threw exception; nested exception is java.lang.IllegalStateException: Cannot locate GORM API implementation. You either don't have a GORM implementation installed (such as the Hibernate plugin) or you are running Grails code outside the context of a Grails application.
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.kroovyban.SystemState': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionManager' threw exception; nested exception is java.lang.IllegalStateException: Cannot locate GORM API implementation. You either don't have a GORM implementation installed (such as the Hibernate plugin) or you are running Grails code outside the context of a Grails application.
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
      at org.springframework.beans.factory.config.AutowireCapableBeanFactory$autowireBeanProperties.call(Unknown Source)
      at org.springframework.beans.factory.config.AutowireCapableBeanFactory$autowireBeanProperties.call(Unknown Source)
      at org.kroovyban.State.<init>(State.groovy)
      at org.kroovyban.SystemState.<init>(State.groovy)
      at BootStrap$_closure1.doCall(BootStrap.groovy:45)
      at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:264)
      at grails.util.Environment.executeForEnvironment(Environment.java:257)
      at grails.util.Environment.executeForCurrentEnvironment(Environment.java:233)
      at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy:343)
      at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy)
      at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:127)
      at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:162)
      at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:187)
      at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:179)
      at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:127)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
      at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
      at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
      at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:127)
      at TestApp$_run_closure1.doCall(TestApp.groovy:82)
      at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:127)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
      at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
      at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
      at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
      at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
      at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
      at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
      at gant.Gant.withBuildListeners(Gant.groovy:427)
      at gant.Gant.this$2$withBuildListeners(Gant.groovy)
      at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
      at gant.Gant.dispatch(Gant.groovy:415)
      at gant.Gant.this$2$dispatch(Gant.groovy)
      at gant.Gant.invokeMethod(Gant.groovy)
      at gant.Gant.executeTargets(Gant.groovy:591)
      at gant.Gant.executeTargets(Gant.groovy:590)
      Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionManager' threw exception; nested exception is java.lang.IllegalStateException: Cannot locate GORM API implementation. You either don't have a GORM implementation installed (such as the Hibernate plugin) or you are running Grails code outside the context of a Grails application.
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
      ... 43 more

        Activity

        Hide
        zyro added a comment -

        confirmed .. i get that error too using domain inheritance in 2.0.0.m1:
        java.lang.IllegalStateException: Cannot locate GORM API implementation. You either don't have a GORM implementation installed (such as the Hibernate plugin) or you are running Grails code outside the context of a Grails application.
        --> but i could not locate the exact cause

        Show
        zyro added a comment - confirmed .. i get that error too using domain inheritance in 2.0.0.m1: java.lang.IllegalStateException: Cannot locate GORM API implementation. You either don't have a GORM implementation installed (such as the Hibernate plugin) or you are running Grails code outside the context of a Grails application. --> but i could not locate the exact cause
        Hide
        Schalk Cronjé added a comment -

        Even by not adding the line to BootStrap, but by adding something like the following to an integration test will still cause the failure

        def b = B.findByName("something")

        will casue the same issue, but

        def a = A.findByName("something")

        will work fine,

        Show
        Schalk Cronjé added a comment - Even by not adding the line to BootStrap, but by adding something like the following to an integration test will still cause the failure def b = B.findByName("something") will casue the same issue, but def a = A.findByName("something") will work fine,

          People

          • Assignee:
            Unassigned
            Reporter:
            Schalk Cronjé
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development