Tuesday 18 August 2015

Exception java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter


Exception:
Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
 at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy.instantiateWithMethodInjection(CglibSubclassingInstantiationStrategy.java:71)
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:75)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:948)
 ... 13 more
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.CallbackFilter
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 ... 16 more


Solution: 

If you get this exception, that means that you are using the earlier version than Spring 3.2 and missing the libraries for CGLIB

Beginning Spring 3.2, all net.sf.cglib classes moved to org.springframework.cglib and inline them directly within the spring-core JAR. CGLIB is a Byte Code Generation Library is high level API to generate and transform Java byte code. It is a third part library now merged to the Spring framework itself.



No comments:

Post a Comment

Spring boot with CORS

CORS (Cross-Origin Resource Sharing) errors occur when a web application running in a browser requests a resource from a different domain or...