spring aop报错:Cannot proxy target class because CGLIB2 is not available.

问题描述

今天在整合spring aop时报了这个错:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpwordDao' defined in ServletContext resource [/WEB-INF/config/spring/data-access-config.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.调查发现应该是缺少包:cglib-nodep-2.2.jar 但是将其加入到buildpath中后还是报同一个错误,估计可能是Spring中的cglib-nodep-2.x.x.jar与Hibernate中的cglib-2.2.jar相冲突,这时需要保留spring的,取消hibernate的,但是查了一遍lib,没有发现hibernate的cglib-2.2.jar,这就不懂是什么情况了,请问谁知道是怎么回事

解决方案

嗯! 你已经找到问题所在了!cglib jar版本 和 你框架的 版本问题! 你看下官方推荐的版本 或者 换更高的版本咯!我们现在项目:spring3.1 使用的 是:cglib-nodep-2.1_3.jar
解决方案二:
导入cglib-nodep-2.1_3.jar包,或者导入asm-2.2.3.jar和cglib-2.2.jar

时间: 2024-09-20 04:23:02

spring aop报错:Cannot proxy target class because CGLIB2 is not available.的相关文章

Spring aop报错:com.sun.proxy.$Proxyxxx cannot be cast to yyy

在使用Spring AOP时,遇到如下的错误: Exception in thread "main" java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to com.spring.test.setter.Instrumentalistat com.spring.test.setter.test.main(test.java:12) 看报错信息,显示的是动态代理生成的类无法转换到我们自定义的实现类. 解决

spring 写junit测试时使用aop报错

问题描述 spring 写junit测试时使用aop报错 当我在我的配置文件中加上如下配置会包下面的错误,我不加时就不会出错这是为什么 <aop:config> <aop:pointcut id="interceptorPointCuts" expression="execution(* cn.qtt.service.*.*(..)) " /> <aop:pointcut id="interceptorPointCutsNew

spring使用中报Cannot proxy target class because CGLIB2 is not available错

发现问题 public interface StudentService {  void add(); } @Service public class StudentServiceImpl implements StudentService {  void add(){  } } public class StudentAction extends ActionSupport {  private StudentService studentService;  @Resource  public

spring batch 报错,求大神赐教,急急急急。。。。。。

问题描述 spring batch 报错,求大神赐教,急急急急...... 2014-2-22 13:13:42 org.springframework.context.support.AbstractApplicationContext prepareRefresh 信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@13d93f4: display name [org.spring

spring mvc 报错,求解答,各位好心人必有好报。

问题描述 spring mvc 报错,求解答,各位好心人必有好报. 六月 07, 2015 6:55:04 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.sp

图片-加入biz层后,配置spring一直报错,求大神解决

问题描述 加入biz层后,配置spring一直报错,求大神解决

tomcat6 spring 启动报错

问题描述 tomcat6 spring 启动报错 java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Mon Jun 09 13:43:08 CST 2014]; root of context

spring security报错,实在是找不出原因

问题描述 spring security报错,实在是找不出原因 说明一下,给别人的项目部署的时候报错的,项目代码没问题,配置也不会错,找了很久的原因不知道错在哪. #这是spring security的配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security

spring cloud 报错Error creating bean with name &amp;#39;hystrixCommandAspect&amp;#39; ,解决方案

  spring cloud 升级到最新版 后,报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hystrixCommandAspect' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.cla