java - 奇怪的 grails 错误信息

标签 java spring grails groovy

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

我有一个名为 ContributionPlanController 的 Controller 。 它有一个服务 ContributionPlanservice。

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

JointPIAService本身,继承自ProductService

我对 ProductService 进行了修改,例如对某些内容进行 println 修改,但总是出现此错误。如果我重新启动应用程序,它将正常工作。

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

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

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:

堆栈跟踪:

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 时,您是使用显式类型(“ContributionPlanService contributionPlanService”)还是动态类型(“def contributionPlanService”)来实现的?

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

既然你提到了它,我希望它会在 1.1.x 中得到修复,但我还没有尝试过。 (我现在无法对其进行测试,但我不想等到将此答案发送给您。尝试一下并告诉我。)

关于java - 奇怪的 grails 错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1582576/

相关文章:

java - 制作了我在 java 中使用 JFrame 制作的应用程序的 .jar 文件。效果 100%。但是当我从网站加载它时,它只是一个空白的白屏

java - Spring Security 不提供静态内容

java - JodaTime 比较两个不同时区的日期

java - 在 Spring Boot 中修改日志请求负载

java - Spring取消@Async任务

grails - Grails Spring Security在身份验证失败时看不到闪存消息

Java 字符串常量池——创建的对象数

java - 同一项目,同一分支,两台机器: unit tests producing inconsistent results

grails - 在 Grails 中注入(inject) grails-app 类

grails - 提交后额外刷新