grails嵌套bean错误

时间:2013-02-27 20:55:52

标签: java grails javabeans

我有一个使用内存数据库的grails网站,在我做了一些严重的域类更改之前正在工作。有什么想法吗?以前从没见过这样的东西。

Error executing bootstraps: Error creating bean with name 'messageSource':     Initialization of bean failed; nested exception is   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError

修改

完整堆栈跟踪

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -  Dgrails.home=/Users/afrieden/grails/grails-1.3.7 -Dbase.dir=/Users/afrieden/GrailsProjects/GRVariantInterface/trunk -Dtools.jar=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/tools.jar -Dgroovy.starter.conf=/Users/afrieden/grails/grails-1.3.7/conf/groovy-starter.conf -Xmx512M -XX:MaxPermSize=192m -Didea.launcher.port=7537 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 12.app/bin" -Dfile.encoding=UTF-8 -classpath "/Users/afrieden/grails/grails-1.3.7/lib/groovy-all-1.7.8.jar:/Users/afrieden/grails/grails-1.3.7/dist/grails-bootstrap-1.3.7.jar:/Applications/IntelliJ IDEA 12.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /Users/afrieden/grails/grails-1.3.7/conf/groovy-starter.conf run-app
Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/afrieden/grails/grails-1.3.7

Base Directory: /Users/afrieden/GrailsProjects/GRVariantInterface/trunk
Resolving dependencies...
Dependencies resolved in 747ms.
Running script /Users/afrieden/grails/grails-1.3.7/scripts/RunApp.groovy
Environment set to development
[groovyc] Compiling 1 source file to /Users/afrieden/GrailsProjects/GRVariantInterface/trunk/target/classes
[delete] Deleting directory /Users/afrieden/.grails/1.3.7/projects/trunk/tomcat
Running Grails application..
2013-02-27 16:04:33,160 [main] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
at org.grails.tomcat.InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:112)
at org.grails.tomcat.InlineExplodedTomcatServer$doStart.callCurrent(Unknown Source)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:97)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _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_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
... 26 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
... 26 more
Caused by: java.lang.ExceptionInInitializerError
... 26 more
Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: grvariant.vardb.UserRole(java.lang.String, java.lang.Integer, java.lang.String)
at grvariant.vardb.UserRole.$INIT(UserRole.groovy)
at grvariant.vardb.UserRole.<clinit>(UserRole.groovy)
... 26 more

Process finished with exit code 1

1 个答案:

答案 0 :(得分:1)

您似乎使用了Spring Security插件,而在UserRole类中则出现了问题。

关键错误信息是:

Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: 
grvariant.vardb.UserRole(java.lang.String, java.lang.Integer, java.lang.String)

我的猜测是2个字符串和1个整数属性与Spring Security想要的原始用户和角色引用不匹配,或者您添加了与Grails / MySQL有一些冲突的String属性,比如使用保留字作为属性名称。

发布此课程的定义可能有助于进一步讨论。