Java Grails找不到customCacheKeyGenerator

Java Grails找不到customCacheKeyGenerator,java,hibernate,grails,groovy,Java,Hibernate,Grails,Groovy,当我运行grailsrunapp时,我没有得到这个错误。但是,当我将其打包为war文件并加载到Tomcat中时,我会这样做: 2014-07-09 10:54:24,386 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creat ing bean with name 'org.springframework.cache.

当我运行
grailsrunapp
时,我没有得到这个错误。但是,当我将其打包为war文件并加载到Tomcat中时,我会这样做:

2014-07-09 10:54:24,386 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creat
ing bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'customCacheKeyGenerator' wh
ile setting bean property 'keyGenerator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean w
ith name 'customCacheKeyGenerator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGenerator]: Constructor threw exception; nested exception is java.lang.R
untimeException: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheIntercept
or#0': Cannot resolve reference to bean 'customCacheKeyGenerator' while setting bean property 'keyGenerator'; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'customCacheKeyGenerator': Instantiation of bean failed; nested
 exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGene
rator]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.c
ache.interceptor.SimpleKeyGenerator
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customCacheKeyGenerator': Instantiation o
f bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cac
he.CustomCacheKeyGenerator]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException:
org.springframework.cache.interceptor.SimpleKeyGenerator
        ... 5 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGenerat
or]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cach
e.interceptor.SimpleKeyGenerator
        ... 5 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
        at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:46)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
        at java.lang.Class.forName(Class.java:190)
        at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:43)
        ... 5 more
2014-07-09 10:54:24,392 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: Error creating bean
with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'customCacheKeyGenerator' while setti
ng bean property 'keyGenerator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'customCacheKeyGenerator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not
 instantiate bean class [grails.plugin.cache.CustomCacheKeyGenerator]: Constructor threw exception; nested exception is java.lang.RuntimeExc
eption: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheIntercept
or#0': Cannot resolve reference to bean 'customCacheKeyGenerator' while setting bean property 'keyGenerator'; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'customCacheKeyGenerator': Instantiation of bean failed; nested
 exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGene
rator]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.c
ache.interceptor.SimpleKeyGenerator
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customCacheKeyGenerator': Instantiation o
f bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cac
he.CustomCacheKeyGenerator]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException:
org.springframework.cache.interceptor.SimpleKeyGenerator
        ... 5 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.cache.CustomCacheKeyGenerat
or]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cach
e.interceptor.SimpleKeyGenerator
        ... 5 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
        at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:46)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: org.springframework.cache.interceptor.SimpleKeyGenerator
        at java.lang.Class.forName(Class.java:190)
        at grails.plugin.cache.CustomCacheKeyGenerator.<init>(CustomCacheKeyGenerator.java:43)
        ... 5 more
解决方案:

  • 从SpringSecurity核心插件2.0.0.RC3升级到RC4
  • 运行grails刷新依赖项
  • 清除
    目标
    插件
    目录
  • 运行
    grailswar
  • compile 'org.hibernate:hibernate-ehcache:4.3.5.Final'
    compile 'org.springframework:spring-context:4.0.5.RELEASE'