Grails app fails to run - grails

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).
I then attempt to run this and get the following error, any clues?: -
| 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
->> 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
->> 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
->> 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
->> 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
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..? : -
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"
}
}
}
}
It also mentions failures with the bootstrap, again I've included it here but its the standard file created on setup and unmodified...?
class BootStrap {
def init = { servletContext ->
}
def destroy = {
}
}
Domain code is: -
package test
class PC {
static constraints = {
MyName()
MyVal1()
MyVal2()
}
String MyName
String MyVal1
String MyVal2
}

Java and Groovy naming convention is to start class names uppercase and variables and instances lowercase. To take advantage of Grails convention, it is recommended to follow the same convention as java and groovy. Grails does some magics based on the variable names, for example, Grails matches domain fields to their database fields by their name or Grails bean autowiring is based on bean's name, therefore, creating variables with UpperCase might have confused it in your case.

Related

Grails oauth plugin doesn't work

I tried to use oauth plugin 2.6.1 on a Grails 2.4.4 blank application.
I followed instruction on documentation for quickstart, however when I start the application I have that stacktrace:
Message: Error creating bean with name 'grails.plugin.databasemigration.DbdocController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instanceControllerTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'instanceControllerTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by InvalidOauthProviderException: [:] configured as an API for facebook does not appear to be a valid Class. It should be a class extending from the org.scribe.builder.Api class
->> 48 | afterPropertiesSet in uk.co.desirableobjects.oauth.scribe.OauthService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
The error seems quite clear, but I don't understand if it's a configuration problem.
This is my configuraton in Config.groovy:
oauth {
providers {
twitter {
api = TwitterApi
key = 'my-key'
secret = 'my-secret'
}
}
}
Make sure you have imported the class FacebookApi in your Config.groovy

GORM Composite mapping not working

On grails 2.4.3 and postgresql as the database I have:
class ClassA {
Set classB = []
static belongsTo = [classC: ClassC]
static hasMany = [classB: ClassB]
}
and:
#EqualsAndHashCode
class ClassB implements Serializable {
ClassA classA
Integer number
static belongsTo = [classA: ClassA]
static mapping = {
id composite: ['number', 'classA']
}
And I'm getting this weird error:
[localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializin
the application: 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.NullPointerException 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.NullPointerException Line | Method ->> 266 | run in
java.util.concurrent.FutureTask - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor | 617 |
run . . . in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run in
java.lang.Thread
What is going on? What I am doing wrong?
not sure, what the message means, but this is wrong:
Set ClassB = []
it should be
Set<ClassB> classB = new HashSet<>()
UPDATE:
see the refdoc. the fields should be of primitive types I'd say.
try converting extracting a property out of the ClassB instance:
#EqualsAndHashCode
class ClassB implements Serializable {
ClassA classA
String someAProp
Integer number
void setClassA( ClassA a ){
classA = a
someAProp = a.someProp
}
static belongsTo = [classA: ClassA]
static mapping = {
id composite: ['number', 'someAProp']
}
}

Grails: Fetch domain object from service init method

I have created a service where in its init method it tries to load an object from the database, but this error is thrown:
Caused by IllegalStateException: Method on class [pruebainitservice.Conf] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
->> 15 | init in pruebainitservice.ConfService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
| Error Forked Grails VM exited with error
I have created an example project, that basically does this; it just contains a domain class, a service, a controller with an action and its view. You can download from here https://github.com/okelet/grails-test-service-init.
Does anyone know why this happens?
Grails version: 2.3.8
Groovy Version: 2.1.8 JVM: 1.7.0_55 Vendor: Oracle Corporation OS: Linux
Regards and thanks in advance.
looks like #PostConstruct annotation is using it's own ClassLoader, hence the exception.
I'd use InitializingBean interface to do the init you need:
class SomeService implements InitializingBean {
#Override
void afterPropertiesSet() throws Exception {
doStuffHere()
}
}
UPDATE:
the only solution I could find was to call the init-method from BootStrap:
class SomeService {
void init(){
log.debug("Cargando configuraciĆ³n...")
def confs = Conf.findAll()
// the rest
}
}
and
class BootStrap {
def confService
def init = { servletContext ->
confService.init()
}
def destroy = {
}
}

Why does Grails not use the provided name of my join table (many-to-many relationship)

Background
I am evaluating Grails and thus have to map the persistence layer for a legacy database. I am starting with three tables:
Clone
among other attributes: primary key id
CloneSet
among other attributes: primary key id
Clone2CloneSet
just two foreign keys cloneID and cloneSetID
The domain classes are coded as follows:
class Clone {
// among others
static hasMany = [cloneSets: CloneSet]
static mapping = {
id (generator: 'identity')
cloneSets (
joinTable: [name: 'Clone2CloneSet', key: 'cloneID', column: 'cloneSetID'],
cascade: 'none'
)
}
}
class CloneSet {
// among others
static hasMany = [clones: Clone]
static belongsTo = Clone
static mappedBy = [clones: "cloneSets"]
static mapping = {
table (name: 'CloneSet')
id (generator: 'identity')
clones (
joinTable: [name: 'Clone2CloneSet', key: 'cloneSetID', column: 'cloneID'],
cascade: 'none'
)
}
}
Problem
Grails seems to insist that the name of my join table is clone2clone_set:
2013-09-12 10:39:26,459 [localhost-startStop-1] INFO hbm2ddl.TableMetadata - table found: mydatabase.dbo.CloneSet
2013-09-12 10:39:26,459 [localhost-startStop-1] INFO hbm2ddl.TableMetadata - columns: [id, ...]
2013-09-12 10:39:26,465 [localhost-startStop-1] INFO hbm2ddl.TableMetadata - table found: mydatabase.dbo.Clone
2013-09-12 10:39:26,465 [localhost-startStop-1] INFO hbm2ddl.TableMetadata - columns: [id, ...]
2013-09-12 10:39:26,469 [localhost-startStop-1] INFO hbm2ddl.DatabaseMetadata - table not found: clone2clone_set
| Error 2013-09-12 10:39:26,481 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: 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 org.hibernate.HibernateException: Missing table: clone2clone_set
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 org.hibernate.HibernateException: Missing table: clone2clone_set
Line | Method
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | 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 org.hibernate.HibernateException: Missing table: clone2clone_set
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: clone2clone_set
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Caused by HibernateException: Missing table: clone2clone_set
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Question
How can I persuade Grails to search for the correct join table?
I suppose you do not need mappedBy in CloneSet.
class CloneSet {
static hasMany = [clones: Clone]
static belongsTo = Clone
//Do you really need this?
//This maps to CloneSet which is incorrect
//static mappedBy = [clones: "cloneSets"]
static mapping = {
table name: 'CloneSet'
id generator: 'identity'
clones joinTable: [name: 'Clone2CloneSet', key: 'cloneSetID',
column: 'cloneID'],
cascade: 'none'
}
}
Moreover, if feasible can table names become CLONE_SET, CLONE_CLONE_SET (or CLONE_CLONE_SET_XREF for cross reference). Grails uses CamelCase for domain names and table are named as Camel_Case.
In my case it worked with setting the table name to clone2cloneset, because SQL Server isn't case-sensitive. (This has to be done for all column names as well: no camel-case notation there.)

Using dynamic scaffolding with a inlist constraint and dynamic finders

Grails 2.0.4 - Using dynamic scaffolding with a inlist constraint and dynamic finders.
I am trying to use a dynamic finder in the inList constraint of a domain object.
If I change the constraint while the application is active via run-app to sample 2 = Aidy.findAll()*.code it works beautifully creating the dropdown on the objects form from the bootstrapped sample data.
However, subsequent bootstrapping of the application using grails run-app fails with a MissingMethodException.
//1- aidyear(blank:false, maxSize:4, inList:{ [] << '0203' << '0304' << '0405' << '0506'}())
//2- aidyear(blank:false, maxSize:4, inList:{ Aidy.findAll()*.code}())
Is using the findAll in a domain's inlist constraint a bad idea? Any suggestions/recommendations?
The abbreviated error is
$ grails run-app
| Running Grails application
| Error 2012-11-09 12:54:16,589 [pool-5-thread-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 org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: edu.uvm.Aidy.findAll() is applicable for argument types: () values: []
Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
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 org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: edu.uvm.Aidy.findAll() is applicable for argument types: () values: []
Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 680 | 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 org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: edu.uvm.Aidy.findAll() is applicable for argument types: () values: []
Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
....
....
...
I have a simple example project at: https://github.com/mlmclaug/scaffold_inlist.git
but it is just the following 2 domain objects, a controller, and a bootstrap.groovy
package edu.uvm
class Aidy {
String code
String desc
Date startDate
Date endDate
String statusInd
static constraints = {
code(unique:true,blank:false, maxSize:4)
desc(blank:false, maxSize:30)
startDate(blank:false)
endDate(blank:false)
statusInd(blank:false, inList:["A","I"])
}
}
package edu.uvm
class TreqMap {
String aidyear
String treq
Integer seqno
static constraints = {
aidyear(blank:false, maxSize:4, inList:{ [] << '0203' << '0304' << '0405' << '0506'}())
//aidyear(blank:false, maxSize:4, inList:{ Aidy.findAll()*.code}())
treq(blank:false, maxSize:6, inList:["BNOTE","SCERT","PERKIN","PNOTE","LNOTE","SNOTE"])
seqno(blank:true, range:0..99)
}
}
package edu.uvm
class TreqMapController {
def scaffold = edu.uvm.TreqMap
}
import edu.uvm.Aidy
class BootStrap {
def init = { servletContext ->
new Aidy(code:'0910', desc:'July 2009 - June 2010', startDate:'07/01/2009', endDate:'06/30/2010', statusInd:'A').save(failOnError:true)
new Aidy(code:'1011', desc:'July 2010 - June 2011', startDate:'07/01/2010', endDate:'06/30/2011', statusInd:'A').save(failOnError:true)
new Aidy(code:'1112', desc:'July 2011 - June 2012', startDate:'07/01/2011', endDate:'06/30/2012', statusInd:'A').save(flush:true,failOnError:true)
println "Loaded " + Aidy.count() + " Aid Years"
}
def destroy = {
}
}

Resources