Grails, Hibernate Event Listeners and ArrayStoreException

The Problem

Trying to register few Hibernate event listeners from plugin, But some how, registering the custom event listeners causes ArrayStoreException at runtime.

In plugin class

 def doWithSpring = {
	sanitizeHtmlListner(SanitizeHtmlListner)
	hibernateEventListeners(HibernateEventListeners) {
		listenerMap = ['save':sanitizeHtmlListner]
	}
    }

Listener class

class SanitizeHtmlListner implements SaveOrUpdateEventListener {
-----
}

Exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization o
f bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with nam
e '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 'sessionFacto
ry': Invocation of init method failed; nested exception is java.lang.ArrayStoreException
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
        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:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initi
alization of bean failed; nested exception is

Solution

No solution is known,

This is a bug in Grails, which will not let you register SaveAndUpdateListener,  and if you do, you get this error. if you try with pre-insert, pre-update listeners it should work. I don’t know what other listeners are affected.

Reported http://jira.grails.org/browse/GRAILS-7576

See

http://grails.1312388.n4.nabble.com/Hibernate-listeners-are-not-called-for-integration-tests-td3546387.html
http://grails.1312388.n4.nabble.com/Hibernate-event-listeners-td3483795.html