使用grails 1.1.1 当我对服务进行修改然后尝试刷新页面时,我收到了此消息。
我有一个控制器名称ContributionPlanController。 它有一个服务ContributionPlanservice。
在ContributionPlanService中,它有ProductService和一些其他服务,包括JointPIAService。
JointPIAService it self,继承自ProductService
我在ProductService上做了一些修改,就像println上的东西一样,这个错误总是出现。如果我重新启动应用程序,它将正常工作。
知道如何解决这个问题吗?
=============================================== ==========================================
Message: Could not initialize class
JointPIAService $$ EnhancerByCGLIB $$ e27c7697 引起:创建bean时出错 name'ContributionPlanController': bean的初始化失败;嵌套 例外是 org.springframework.beans.factory.BeanCreationException: 使用名称创建bean时出错 'contributionPlanService':不能 创建内部bean'(内部bean)'而 设置bean属性'target';嵌套 例外是 org.springframework.beans.factory.BeanCreationException: 创建名称为'的bean时出错(内部 bean)#21':bean的初始化 失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException: 使用名称创建bean时出错 'jointPIAService':init的调用 方法失败;嵌套异常是 org.springframework.aop.framework.AopConfigException: 无法生成CGLIB子类 class [class JointPIAService]:常见 这个问题的原因包括使用a 最后一堂课或不可见的课; 嵌套异常是 net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException - >空 类:未知行:[ - 1]代码 片段:
堆栈追踪:
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
=============================================== ===========================================
答案 0 :(得分:2)
当您在ContributionPlanController中声明ContributionPlanService时,您是通过显式输入(“ContributionPlanService contributionPlanService”)还是使用动态类型(“def contributionPlanService”)来实现的?
在1.0.4中,自动布线和热交换的组合仅适用于动态类型(def ...)。也就是说,显式声明的服务在第一次启动应用程序时会自动连接,但此后热插拔会被挫败。将声明更改为def将使热交换工作,但是您失去了IDE帮助您的好处。
现在您提到它,我希望这将在1.1.x中修复,但我还没有尝试过。 (我现在无法正确测试它,但我不想等你发送这个答案。试试看,让我知道。)