ContributionPlanservice

ContributionPlanservice

使用grails 1.1.1
在对服务进行修改,然后尝试刷新页面时,收到了此消息。

我有一个 Controller 名称ContributionPlanController。
它具有服务ContributionPlanservice。

在ContributionPlanService内部,它具有ProductService和其他一些服务,包括JointPIAService。

自己的JointPIAService,继承自ProductService

我对ProductService进行了修改,例如对某些内容进行了println,并且始终出现此错误。如果我重新启动该应用程序,它将可以正常工作。

知道如何解决这个问题吗?

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



堆栈跟踪 :

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

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

最佳答案

在ContributionPlanController中声明ContributionPlanService时,是使用显式类型(“ContributionPlanServicetributionPlanService”)还是动态类型(“deftributionPlanService”)进行了声明?

在1.0.4中, Autowiring 和热插拔的组合仅适用于动态类型(def ...)。也就是说,一个明确声明的服务将在您第一次启动该应用程序时自动连接好,但是此后的热交换将被阻止。将声明更改为def会使热插拔工作正常进行,但随后您将失去IDE帮助您的好处。

既然您提到了它,我希望可以在1.1.x中修复它,但是我还没有尝试过。 (我目前无法立即对其进行测试,但我不想等待向您发送此答案。请尝试并让我知道。)

09-03 22:23