【问题标题】:grails - error executing bootstrap (Error creating bean with name 'messageSource')grails - 执行引导程序时出错(创建名称为“messageSource”的 bean 时出错)
【发布时间】:2012-01-17 03:30:31
【问题描述】:

我做了一些看似无害的更改(添加了一些域类,添加了插件购物车),现在显然 BootStrap.groovy 类根本不执行。

虽然我对 BootStrap.groovy 进行了一些更改,但我恢复了一个以前运行良好的文件,但被错误吓傻了。此外,在良好的(旧的)BootStrap.groovy 中,我在 init 操作的顶部放置了一些 println 语句,但这些语句没有打印出来,甚至似乎都没有到达。最后,我卸载了插件,然后手动删除了购物车插件文件夹。

您知道这个错误是什么,或者有任何调试指导吗? (正在运行 Grails 1.3.7)

Running Grails application..
Configuring Spring Security ...
Configuring Spring Security UI ...

2011-12-09 13:51:33,036 [main] 错误 context.GrailsContextLoader - 执行引导程序时出错:使用名称创建 bean 时出错 'messageSource': bean 初始化失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“transactionManager”的bean:无法解析引用 在设置 bean 属性 'sessionFactory' 时 bean 'sessionFactory'; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“sessionFactory”的bean:调用init方法 失败的;嵌套异常是 org.hibernate.MappingException: Type [null] 不是基本类型或域类,不能被映射。 在 [mapping] 块中指定类型或使用基本类型 (字符串、整数等) org.springframework.beans.factory.BeanCreationException:错误 创建名为'messageSource'的bean:bean的初始化 失败的;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“transactionManager”的bean:无法解析引用 在设置 bean 属性 'sessionFactory' 时 bean 'sessionFactory'; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“sessionFactory”的bean:调用init方法 失败的;嵌套异常是 org.hibernate.MappingException: Type [null] 不是基本类型或域类,不能被映射。 在 [mapping] 块中指定类型或使用基本类型 (字符串、整数等)在 org.grails.tomcat.TomcatServer.startSecure(TomcatServer.groovy:289) 在 grails.web.container.EmbeddableServer$startSecure.call(未知 来源)在 _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:152) 在 _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) 在 _GrailsS​​ettings_groovy$_run_closure10.doCall(_GrailsS​​ettings_groovy:280) 在 _GrailsS​​ettings_groovy$_run_closure10.call(_GrailsS​​ettings_groovy) 在 _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149) 在 _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116) at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) at _GrailsRun_groovy$_run_closure2.doCall(_GrailsRun_groovy:66) at RunApp ) 在 gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) 在 gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) 在 gant.Gant$_dispatch_closure7.doCall(Gant.groovy) 在 gant.Gant.withBuildListeners(Gant.groovy:427) 在 gant.Gant.this$2$withBuildListeners(Gant.groovy) 在 gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:415) 在 gant.Gant.this$2$dispatch(Gant.groovy) 在 gant.Gant.invokeMethod(Gant.groovy) 在 gant.Gant.executeTargets(Gant.groovy:590) 在 gant.Gant.executeTargets(Gant.groovy:589) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 引起:org.springframework.beans.factory.BeanCreationException: 创建名为“transactionManager”的 bean 时出错:无法解析 在设置 bean 属性时引用 bean 'sessionFactory' '会话工厂';嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“sessionFactory”的bean:调用init方法 失败的;嵌套异常是 org.hibernate.MappingException: Type [null] 不是基本类型或域类,不能被映射。 在 [mapping] 块中指定类型或使用基本类型 (字符串,整数等)... 24 更多原因: org.springframework.beans.factory.BeanCreationException:错误 创建名为“sessionFactory”的bean:调用init方法 失败的;嵌套异常是 org.hibernate.MappingException: Type [null] 不是基本类型或域类,不能被映射。 在 [mapping] 块中指定类型或使用基本类型 (字符串,整数等)... 24 更多原因: org.hibernate.MappingException:类型 [null] 不是基本类型或 域类,无法映射。在 [映射] 阻止或使用基本类型(字符串、整数等)... 24 更多

进程以退出代码 1 结束

【问题讨论】:

  • 我尝试了“帮助”并将上面的内容放到一个代码块中,所以我不必缩进每一行,但解释的帮助机制似乎不起作用...... ?

标签: grails


【解决方案1】:

我删除了所有新的域类和对它们的引用,错误就消失了。我会在找出问题所在后立即更新此内容,希望与 Spring Security 类(用户)之一的域更改无关。

好的,问题是/曾经,我在添加的一个域类的顶部有一个枚举声明。如果我将枚举声明移到类声明下方,那么一切都很好。我想这是一个休眠错误/问题?

【讨论】:

  • 您的消息的关键行以nested exception is org.hibernate.MappingException 开头,并继续说明 Grails/Hibernate 在将您的 Enum/Domain 类映射到数据库时遇到问题。
【解决方案2】:

我猜想您在其中一个域类中使用“def”或域类中的某些其他无效类型的域类中存在问题。

【讨论】:

    猜你喜欢
    • 2020-02-23
    • 1970-01-01
    • 1970-01-01
    • 2012-01-29
    • 2017-06-05
    • 2017-02-26
    • 2015-02-23
    • 1970-01-01
    • 2022-07-21
    相关资源
    最近更新 更多