mardi 31 mars 2015

Upgrade de Grails 2.4.4 vers la version 2.5.0


Voici un petit retour d'expérience pour ceux qui souhaiteraient mettre à jour leur version de Grails.
Cette mise à jour ne m'a posé aucun problème.Il suffit de bien suivre la Release Version ( https://github.com/grails/grails-core/releases/tag/v2.5.0 )

Pour résumé, j'ai seulement mis à jour les plugins suivants dans le fichier BuildConfig.groovy :
  • build ':tomcat:7.0.55.2'
  • compile ':cache:1.1.8'
  • compile ':scaffolding:2.1.2'
  • compile ':asset-pipeline:2.1.5'

J'ai eu une exception au démarrage de Grails car j'avais oublié de changer la valeur de region.factory_class dans le fichier Datasource.groovy ( cf Release Version ).
Voici l'exception que j'ai eu :

2015-03-31 16:28:39,590 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - 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 'transactionManager_lookup' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_lookup': Cannot resolve reference to bean 'sessionFactory_lookup' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_lookup': Invocation of init method failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
...
Et la solution pour résoudre ce problème :
hibernate {
    ...
    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory'
}