Exception in thread “main” java.lang.IllegalStateException: CGLIB is required to process @Configuration classes

During developing Spring applications we might get below exception, basically we might get this exception when we are using “@Configuration” annotation in our Application and we are not adding the “cglib-nodep”  jar in to class path.

 

Mar 11, 2015 3:59:36 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1d8c528: startup date [Wed Mar 11 15:59:36 IST 2015]; root of context hierarchy
Exception in thread “main” java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [applicationConfig]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:294)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:197)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:620)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
at com.connect2java.spring.App.main(App.java:13)

 

 

Solution:

When we use JavaConfig , i.e “@Configuration” annotation , we need to include CGLIB library in class path.

Please include the below decency to pom.xml file and rebuild the application and run the application , so that the above exception will not appears.

if you are not using Maven , add manually cglib-nodep-2.2.2.jar to classpath and run the application , so that the above exception will not appears..

 

 

 

Posted in exceptions, Spring and tagged , , .

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">