Cannot proxy target class because CGLIB2 is not available Solution


When you make a Spring AOP project and run it, you might face this error "org.springframework.aop. framework.AopConfigException:". Let's see what this error is and how to solve this error.

Caused by: 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.aop.framework.DefaultAopProxyFactory.createAopProxy( at org.springframework.aop.framework.ProxyCreatorSupport.createAopProxy( at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance( at org.springframework.aop.framework.ProxyFactoryBean.getObject( at$ ... 9 more

In above exception stack trace it is saying that spring container Cannot proxy target class because CGLIB2 is not available in the classpath


In Spring AOP, we have to include the cglib library into our build path to get rid of the "Cannot proxy target class because CGLIB2 is not available" error message.

Add CGLIB 2 jars in your application's classpath

  1. Download CGLIB2 jars from sourceforge and put it in application classpath download cglib
  2. Add Maven Dependency
  3. <!-- --> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2.2</version> </dependency>

If we run your AOP application after doing certain changes , then our project will run without any exception.

If you have any other doubt, feel free to ask us in the comments section, we will try to solve it too.

Solution Worked 0 UpvotesUpvote


Solution Didn't Worked 0 DownvotesDownvote




Earn Money by Submitting Articles
Start submutting articles. Click here to get started
Play 2048 Game Online

Play Duckhunt Online
Search Tags