简体   繁体   中英

weird grails error message

Using grails 1.1.1 I got this message when I did a modification on a service and then tried to refresh the page.

I have a controller name ContributionPlanController. It has a service ContributionPlanservice.

inside the ContributionPlanService, it has ProductService and some other Services including JointPIAService.

JointPIAService it self, inherited from ProductService

I did a modification on ProductService, like println on something and this errors always appeared. If I restarted the application, it will works fine.

Any idea how to solve this ?

=========================================================================================

 Message: Could not initialize class 

JointPIAService$$EnhancerByCGLIB$$e27c7697 Caused by: Error creating bean with name 'ContributionPlanController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contributionPlanService': Cannot create inner bean '(inner bean)' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#21': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jointPIAService': Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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 Class: Unknown At Line: [-1] Code Snippet:

Stack Trace :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ContributionPlanController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contributionPlanService': Cannot create inner bean '(inner bean)' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#21': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jointPIAService': Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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

    at java.security.AccessController.doPrivileged(Native Method)

    at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)

    at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contributionPlanService': Cannot create inner bean '(inner bean)' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#21': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jointPIAService': Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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

    at java.security.AccessController.doPrivileged(Native Method)

    ... 3 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#21': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jointPIAService': Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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

    at java.security.AccessController.doPrivileged(Native Method)

    ... 4 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jointPIAService': Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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

    at java.security.AccessController.doPrivileged(Native Method)

    ... 5 more

Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class JointPIAService]: 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

    ... 6 more

Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

    at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:622)

    at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:609)

    at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:631)

    at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)

    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:231)

    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)

    at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)

    ... 6 more

Caused by: java.lang.reflect.InvocationTargetException

    at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:616)

    ... 12 more

Caused by: java.lang.NoClassDefFoundError: Could not initialize class JointPIAService$$EnhancerByCGLIB$$e27c7697

    ... 13 more

==========================================================================================

When you declared ContributionPlanService within ContributionPlanController, did you do so with explicit typing ("ContributionPlanService contributionPlanService") or with dynamic typing ("def contributionPlanService")?

In 1.0.4, the combination of auto-wiring and hot swapping only worked with dynamic typing (def ...). That is, that an explicitly declared service would get auto-wired okay the first time you start up the app, but that the hot swapping is foiled thereafter. Changing the declaring to def would make the hot swapping work, but then you lose the benefit of your IDE helping you out.

Now that you mention it, I was hoping this would be fixed in 1.1.x, but I haven't tried it yet. (I'm not in a position to test it right this moment, but I didn't want to wait to send you this answer. Try it and let me know.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM