• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spring AOP aspect4j logger on the spring mvc application

 
john wutka
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


When running spring AOP aspect4j logger on the spring mvc application getting above exception.


java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:203)


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateIndicatorClient' defined in class path resource [applicationContext-xyz.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class $Proxy15]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy15


How can i resolve it. Please advise.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the cglib jar file in your class path? The class that you want a proxy for, is it a final class? CGLIB extends your class to create a proxy for it.

The best overall solution is to code to interfaces. Have interfaces for your classes and implement them then and allow Spring to create DynamicProxy objects to proxy your object.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic