title: Grails 3.3.6 Does not come with GORM Configured?
body: <p>I had to upgrade a grails plugin from 2.3.11 to 3.3.6. When I was testing the finished port I noticed errors on my GORM queries. If I recall, in grails 2 GORM already came with it. Is that not the case in grails 3.3.6 ? What do I need to do to enable GORM? I will mention that I am using a SQL Server datasource. Here is the error I get from grails console doing a simple <code>Person.first()</code></p>
  
  <pre><code>Exception thrown
  
  java.lang.IllegalStateException: Either class [comp.Person] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.
  
      at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:469)
  
      at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:300)
  
      at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:296)
  
      at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormStaticApi(GormEntity.groovy:1368)
  
      at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
  
      at comp.Person.currentGormStaticApi(Person.groovy)
  
      at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
  
      at org.grails.datastore.gorm.GormEntity$Trait$Helper.first(GormEntity.groovy:720)
  
      at org.grails.datastore.gorm.GormEntity$Trait$Helper$first.call(Unknown Source)
  
      at comp.Person.first(Person.groovy)
  
      at comp.Person$first.call(Unknown Source)
  
      at ConsoleScript1.run(ConsoleScript1:3)
  
      at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
  </code></pre>
  
  <p>In my <code>gradle.properties</code> file it says <code>gormVersion=6.1.10.BUILD-SNAPSHOT</code></p>
  
  <p>And here is my <code>build.gradle</code></p>
  
  <pre><code>buildscript {
      repositories {
          mavenLocal()
          maven { url "https://repo.grails.org/grails/core" }
      }
      dependencies {
          classpath "org.grails:grails-gradle-plugin:$grailsVersion"
          classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2"
  
      }
  }
  
  version "2.0-SNAPSHOT"
  group "pluginmigration"
  
  apply plugin:"eclipse"
  apply plugin:"idea"
  apply plugin:"org.grails.grails-plugin"
  apply plugin:"org.grails.grails-plugin-publish"
  apply plugin:"asset-pipeline"
  apply plugin:"org.grails.grails-gsp"
  
  repositories {
      mavenLocal()
      maven { url "https://repo.grails.org/grails/core" }
  }
  
  dependencies {
  
      //compile "org.grails.plugins:hibernate5:6.1.10"
      //compile "org.hibernate:hibernate-ehcache"
      compile 'org.grails.plugins:spring-security-core:3.2.3'
      compile 'org.grails.plugins:spring-security-ldap:3.0.2'
      compile "org.springframework.boot:spring-boot-starter-logging"
      compile "org.springframework.boot:spring-boot-autoconfigure"
      compile "org.grails:grails-core"
      compile "org.springframework.boot:spring-boot-starter-actuator"
      compile "org.springframework.boot:spring-boot-starter-tomcat"
      compile "org.grails:grails-web-boot"
      compile "org.grails:grails-logging"
      compile "org.grails:grails-plugin-rest"
      compile "org.grails:grails-plugin-databinding"
      compile "org.grails:grails-plugin-i18n"
      compile "org.grails:grails-plugin-services"
      compile "org.grails:grails-plugin-url-mappings"
      compile "org.grails:grails-plugin-interceptors"
      compile "org.grails.plugins:cache"
      compile "org.grails.plugins:async"
      compile "org.grails.plugins:scaffolding"
      compile "org.grails.plugins:gsp"
      console "org.grails:grails-console"
      profile "org.grails.profiles:web-plugin"
      provided "org.grails:grails-plugin-services"
      provided "org.grails:grails-plugin-domain-class"
      runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2"
      runtime 'net.sourceforge.jtds:jtds:1.3.1'
      testCompile "org.grails:grails-gorm-testing-support"
      testCompile "org.grails:grails-plugin-testing"
      testCompile "org.grails:grails-web-testing-support"
  }
  
  bootRun {
      jvmArgs('-Dspring.output.ansi.enabled=always')
      addResources = true
      String springProfilesActive = 'spring.profiles.active'
      systemProperty springProfilesActive, System.getProperty(springProfilesActive)
  }
  
  // enable if you wish to package this plugin as a standalone application
  bootRepackage.enabled = false
  grailsPublish {
      // TODO: Provide values here
      user = 'user'
      key = 'key'
      githubSlug = 'foo/bar'
      license {
          name = 'Apache-2.0'
      }
      title = "My Plugin"
      desc = "Full plugin description"
      developers = [johndoe:"John Doe"]
  }
  
  
  
  assets {
      packagePlugin = true
  }
  </code></pre>
  
  <p>EDIT: Here is the stacktrace error I get when I include the hibernate dependencies:</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/
  ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastoreServiceRegistry': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
   [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException
          at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1181)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1075)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
          at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:225)
          at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:703)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528)
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
          at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
          at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
          at grails.boot.GrailsApp.run(GrailsApp.groovy:84)
          at grails.boot.GrailsApp.run(GrailsApp.groovy:393)
          at grails.boot.GrailsApp.run(GrailsApp.groovy:380)
          at grails.boot.GrailsApp$run.call(Unknown Source)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
          at pluginmigration.Application.main(Application.groovy:7)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastoreServiceRegistry': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org
  .springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
          at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:648)
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:145)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1201)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:931)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:808)
          at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:564)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:432)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
          at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:206)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1267)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
          at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
          at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
          ... 24 common frames omitted
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.B
  eanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1201)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
          ... 40 common frames omitted
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerExcept
  ion
          at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
          ... 49 common frames omitted
  Caused by: java.lang.NullPointerException: null
          at java.util.Hashtable.put(Hashtable.java:460)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings$HibernateSettings.populateProperties(HibernateConnectionSourceSettings.groovy:258)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings$HibernateSettings.populateProperties(HibernateConnectionSourceSettings.groovy:255)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings$HibernateSettings.populateProperties(HibernateConnectionSourceSettings.groovy:255)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings$HibernateSettings.toProperties(HibernateConnectionSourceSettings.groovy:246)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings$HibernateSettings$toProperties.call(Unknown Source)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettings.toProperties(HibernateConnectionSourceSettings.groovy:51)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.buildConfiguration(HibernateConnectionSourceFactory.java:242)
          at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.create(HibernateConnectionSourceFactory.java:85)
          at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:39)
          at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:23)
          at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:64)
          at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52)
          at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24)
          at org.grails.orm.hibernate.HibernateDatastore.&lt;init&gt;(HibernateDatastore.java:204)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
          at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076)
          at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
          ... 51 common frames omitted
  </code></pre>
  
  <p>EDIT2: As requested, my datasource block in <code>application.yml</code> has been included (also have hibernate incase it matters):</p>
  
  <pre><code>---
  hibernate:
    cache:
      queries: false
      use_second_level_cache: true
      use_query_cache: false
      region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
  
  
    environments:
      development:
        dataSources:
          one:
            dialect: org.hibernate.dialect.SQLServer2008Dialect
            logSql: true
            formatSql: true
            driverClassName: net.sourceforge.jtds.jdbc.Driver
            dbCreate: none
            url: jdbc:jtds:sqlserver://localhost:1804/one
            username: u
            password: p
  
          two:
            dialect: org.hibernate.dialect.SQLServer2008Dialect
            logSql: true
            formatSql: true
            driverClassName: net.sourceforge.jtds.jdbc.Driver
            dbCreate: none
            url: jdbc:jtds:sqlserver://localhost:1804/two
            username: u
            password: p
  
          three:
            dialect: org.hibernate.dialect.SQLServer2008Dialect
            logSql: true
            formatSql: true
            driverClassName: net.sourceforge.jtds.jdbc.Driver
            dbCreate: none
            url: jdbc:jtds:sqlserver://localhost:1804/three
            username: u
            password: p
  
      test:
        dataSources:
      production:
        dataSources:
  </code></pre>