Error executing script TestApp: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'testService':
Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class $Proxy11]: 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 $Proxy11
To solve this problem you have to add the following line to your resources.xml (in grails-app/conf/spring):
<aop:aspectj-autoproxy proxy-target-class="true"/>
Your final resources.xml will look like this:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <aop:aspectj-autoproxy proxy-target-class="true"/> </beans>
This was tested with Grails 1.2.2 and Grails 1.3.0.
Dieser Kommentar wurde vom Autor entfernt.
AntwortenLöschenHi
AntwortenLöschenI am trying to run Grails integration test using @Transactional annotation in my code, but I am getting the below exception .. would you have any idea? I have set proxy-target-class to true in my resources.xml but it didn't help.. If I remove the annotation, it is working properly..
Could not generate CGLIB subclass of class [class com.uim.event.integration.EventDispatcherServiceTests]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.uim.event.integration.EventDispatcherServiceTests]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib