Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify pr

原创 2014年12月17日 14:13:10
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in file [C:\myeclipseenvironment\workspace\springworkspace\Spring_019_Spring_Hibernate_Transaction_Annotation\bin\com\spring\service\UserService.class]: 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.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.spring.service.UserServiceTest.testAdd(UserServiceTest.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


问题解决:缺少jar包 cglib-2.1.3.jar 

Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify pr

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService'...
  • l1028386804
  • l1028386804
  • 2013年12月19日 20:08
  • 5120

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

发现问题 public interface StudentService {  void add(); } @Service public class StudentServiceImpl...
  • woshixuye
  • woshixuye
  • 2012年08月26日 10:18
  • 5927

Spring 错误Cannot proxy target class because CGLIB2 is not available

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService'...
  • zcg_java
  • zcg_java
  • 2014年12月22日 23:28
  • 1116

Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the...

导入cglib-nodep-.jar包就可以了
  • qianyuqianlin
  • qianyuqianlin
  • 2012年07月10日 13:55
  • 188

Cannot proxy target class because CGLIB is not available. Add CGLIB to the class path or specify pr

缺少cglib 的jar包,引入即可!
  • J_mani
  • J_mani
  • 2017年04月24日 00:19
  • 110

Spring强制使用CGLIB代理事务

JDK的动态代理:主要是针对实现了接口的类生成代理 CGLIB:是针对类生成代理,针对指定的类生成一个子类,覆盖里面的方法,所以指定的类不能是final包括方法. 实现原理类似于JDK动态代理,...
  • WWWTYB
  • WWWTYB
  • 2010年06月30日 10:45
  • 7892

springMvc+myBatis报错Cannot enable lazy loading because CGLIB is not available. Add CGLIB to your

Cannot enable lazy loading because CGLIB is not available. Add CGLIB to your 个人解决方法,加入cglib.jar...
  • zhangjianghao4
  • zhangjianghao4
  • 2015年04月07日 11:08
  • 4008

mybatis源码学习--mybatis懒加载内部原理

笔者最近研究mybatis比较多,所以打算把最近研究的mybatis的心得写出来,以免以后忘记,算是对这阶段的总结吧 mybatis的懒加载配置什么的我就不详细说了,可以到我的github地址,看...
  • mingtian625
  • mingtian625
  • 2015年08月08日 14:05
  • 4165

Cannot proxy target class because CGLIB2 is not available

今天在利用spring框架部署开发项目时, 结果发现弹出一警告框: cannot Deploy smartservice Deployment Error for module: sm...
  • Ro_bot
  • Ro_bot
  • 2016年03月23日 23:07
  • 438

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

使用Spring的aop是遇到如下错误: Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy ...
  • kingsonyoung
  • kingsonyoung
  • 2016年03月06日 09:08
  • 210
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify pr
举报原因:
原因补充:

(最多只允许输入30个字)