即使在类实现接口时,也使用CGLIB代理

时间:2012-09-06 11:38:11

标签: spring gwt-rpc spring-aop

我试图使用Spring AOP拦截我的GWT-RPC应用程序的方法(使用GWT-Server库,因此RPC服务不会扩展RemoteServiceServlet)。当我将war部署到tomcat并启动应用程序时,CGLIB由于某种原因而失败。但我不明白为什么CGLIB首先被用于代理。由于我的RPC类实现了接口,不应该使用JDK动态代理吗?

我有什么需要做的来调试这个问题吗?请建议。

注意:仅供参考,Spring会遇到此异常,但我认为这是一个不同的问题,我无法理解为什么CGLIB代理会出现在图片中。

Caused by: net.sf.cglib.core.CodeGenerationException: 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.

1 个答案:

答案 0 :(得分:0)

为了可能犯同样错误的其他(罕见)人员的回答。

spring AOP的方面设置不正确,实际上是在尝试定位上下文中的几乎所有类,这就是为什么EhCache开始导致问题,因为有多个CacheManager实例(因为CGLIB代理作为CacheManager没有实现接口)