hibernate - Grails 2.5 & SpringAcl: aclCacheManager bean not accessible -


after migrating 2.4.x last 2.5.0 release, i've changed params hibernate in datasource:

cache.region.factory_class = 'org.hibernate.cache.ehcache.singletonehcacheregionfactory' 

and config.groovy:

grails.cache.enabled = true grails.cache.clearatstartup = true grails.hibernate.cache.queries = false beans.cachemanager.cachemanagername = 'springcachecachemanager' beans.cachemanager.shared = true 

in resources.groovy, ehcache bean set this:

ehcache(ehcachefactorybean) { bean ->         cachemanager = ref("springcachecachemanager")         cachename = "cache"         eternal = false         shared = true         diskpersistent = false         memorystoreevictionpolicy = "lru"         maxentrieslocalheap = "10000"         timetoidleseconds = "120"         timetoliveseconds = "120"         maxentrieslocaldisk = "10000000"         diskexpirythreadintervalseconds = "120"      } 

then, issue springaclservice aclcachemanager appears @ bootstrap:

objc[41029]: class javalaunchhelper implemented in both /library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/home/bin/java , /library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/home/jre/lib/libinstrument.dylib. 1 of 2 used. 1 undefined. |loading grails 2.5.0 |configuring classpath . |environment set development ................................. |packaging grails application ........... |compiling 1 source files .................................................................log4j consolelevel: warn appfile level: debug .. |running grails application objc[41057]: class javalaunchhelper implemented in both /library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/home/bin/java , /library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/home/jre/lib/libinstrument.dylib. 1 of 2 used. 1 undefined. log4j consolelevel: warn appfile level: debug configuring spring security core ... ... finished configuring spring security core configuring spring security acl ... ... finished configuring spring security acl 2015-03-28 18:53:44,111 error [defaulturlmappingevaluator$urlmappingbuilder] - url mapping argument [exception] value [(*)] must valid class 2015-03-28 18:53:44,113 error [defaulturlmappingevaluator$urlmappingbuilder] - url mapping argument [exception] value [(*)] must valid class 2015-03-28 18:53:45,342 error [grailscontextloaderlistener] - error initializing application: error creating bean name 'afteraclcollectionread': cannot resolve reference bean 'aclservice' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'springsecurityaclaclservice': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcache': cannot resolve reference bean 'ehcacheaclcache' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'ehcacheaclcache': cannot resolve reference bean 'aclcachemanager' while setting bean property 'cachemanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ] org.springframework.beans.factory.beancreationexception: error creating bean name 'afteraclcollectionread': cannot resolve reference bean 'aclservice' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'springsecurityaclaclservice': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcache': cannot resolve reference bean 'ehcacheaclcache' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'ehcacheaclcache': cannot resolve reference bean 'aclcachemanager' while setting bean property 'cachemanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     @ java.util.concurrent.futuretask.run(futuretask.java:266)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142)  @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617)  @ java.lang.thread.run(thread.java:745) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'springsecurityaclaclservice': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcache': cannot resolve reference bean 'ehcacheaclcache' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'ehcacheaclcache': cannot resolve reference bean 'aclcachemanager' while setting bean property 'cachemanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     ... 4 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcache': cannot resolve reference bean 'ehcacheaclcache' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'ehcacheaclcache': cannot resolve reference bean 'aclcachemanager' while setting bean property 'cachemanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     ... 4 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'ehcacheaclcache': cannot resolve reference bean 'aclcachemanager' while setting bean property 'cachemanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     ... 4 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'aclcachemanager': invocation of init method failed; nested exception net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     ... 4 more caused by: net.sf.ehcache.cacheexception: unnamed cachemanager exists in same vm. please provide unique names each cachemanager in config or 1 of following: 1. use 1 of cachemanager.create() static factory methods reuse same cachemanager same name or create 1 if necessary 2. shutdown earlier cachemanager before creating new 1 same name. source of existing cachemanager is: defaultconfigurationsource [ ehcache.xml or ehcache-failsafe.xml ]     @ net.sf.ehcache.cachemanager.assertnocachemanagerexistswithsamename(cachemanager.java:529)    @ net.sf.ehcache.cachemanager.init(cachemanager.java:374)  @ net.sf.ehcache.cachemanager.<init>(cachemanager.java:259)    ... 4 more error | 

i encountered same issue trying upgrade grails 2.4.3 -> 2.5.0.

i think problem stems changes in way new hibernate/cache plugins create cachemanager. discussions here, here , here, looks newer versions (i.e. used in grails 2.5.0) not permit multiple unnamed cache managers, spring-security-acl plugin not able create own manager once hibernate cachemanager created.

i have thought naming hibernate cachemanager fix problem (like you've done), no dice.

my temporary (untested) workaround add following application's resources.groovy:

 aclcachemanager(org.springframework.cache.ehcache.ehcachemanagerfactorybean) {   shared = true 

}

i don't know if means acl plugin share same cache manager hibernate, i'm not fussed caching right i'm happy long application running.

try , see how on.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -