Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails app fails to run
    text
    copied!<p>So, I've just created a brand new grails app, created one Domain with a few fields, and then a controller and a set of views based from the domain (using grails built in generate commands).</p> <p>I then attempt to run this and get the following error, any clues?: -</p> <pre><code>| Error 2013-10-24 12:08:11,643 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Can not set java.lang.String field test.PC.MyName to java.lang.Class Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Can not set java.lang.String field test.PC.MyName to java.lang.Class Line | Method -&gt;&gt; 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Can not set java.lang.String field test.PC.MyName to java.lang.Class -&gt;&gt; 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Can not set java.lang.String field test.PC.MyName to java.lang.Class -&gt;&gt; 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread Caused by IllegalArgumentException: Can not set java.lang.String field test.PC.MyName to java.lang.Class -&gt;&gt; 6 | doCall in test.PC$__clinit__closure1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 334 | innerRun in java.util.concurrent.FutureTask$Sync | 166 | run . . . in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker </code></pre> <p>At the risk over overfilling this with data, a quick google suggests this could be something to do with my datasource? If so my datasource file looks like so which is the standard template for when a project is first generated so should work..? : -</p> <pre><code>dataSource { pooled = true driverClassName = "org.h2.Driver" username = "sa" password = "" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' } // environment specific settings environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', '' url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000" } } test { dataSource { dbCreate = "update" url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000" } } production { dataSource { dbCreate = "update" url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000" pooled = true properties { maxActive = -1 minEvictableIdleTimeMillis=1800000 timeBetweenEvictionRunsMillis=1800000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery="SELECT 1" } } } } </code></pre> <p>It also mentions failures with the bootstrap, again I've included it here but its the standard file created on setup and unmodified...?</p> <pre><code>class BootStrap { def init = { servletContext -&gt; } def destroy = { } } </code></pre> <p>Domain code is: -</p> <pre><code>package test class PC { static constraints = { MyName() MyVal1() MyVal2() } String MyName String MyVal1 String MyVal2 } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload