grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.79k stars 950 forks source link

GRAILS-7612: MissingPropertyException: No such property: eventListeners for SessionFactoryProxy #8051

Closed graemerocher closed 9 years ago

graemerocher commented 13 years ago

Original Reporter: dbtanner Environment: grails 1.4.0.M1 Version: 1.4-M1 Migrated From: http://jira.grails.org/browse/GRAILS-7612

I'm seeing this at startup with the audit-logging plugin and grails 1.4.0.M1: {quote} 2011-06-10 23:55:27,848 [Thread-18] ERROR context.GrailsContextLoader - Error executing bootstraps: No such property: eventListeners for class: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy groovy.lang.MissingPropertyException: No such property: eventListeners for class: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy at AuditLoggingGrailsPlugin$_closure2.doCall(AuditLoggingGrailsPlugin.groovy:90) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) {quote}

It appears that in development mode as of grails 1.4, objects are given a SessionFactoryProxy instead of a SessionFactoryImpl, and the getEventListeners interface isn't defined in the hibernate SessionFactory interface; it's only available in the SessionFactoryImpl class.
http://grails.org/doc/1.4.x/api/index.html?org/codehaus/groovy/grails/orm/hibernate/SessionFactoryProxy.html

graemerocher commented 13 years ago

graemerocher said: We may be able to fix this in Grails core actually by implementing propertyMissing in SessionFactoryProxy

graemerocher commented 13 years ago

dantanner said: Yeah - I couldn't find any info on why that method wasn't already part of the SessionFactory interface. It seems like a stable choice to add it to SessionFactoryProxy, since there's only one implementation of the SessionFactory interface, and I don't think that method's going away anytime soon.