Ray
Ray

Reputation: 6115

grails - error executing bootstrap (Error creating bean with name 'messageSource')

I made some seemingly harmless changes (added a few domain classes, added the plugin shopping-cart), and now apparently the BootStrap.groovy class doesn't execute at all.

While I made a few changes to BootStrap.groovy, I restored a previously good file that works fine, dumbfounded by the error. Also, in the good (old) BootStrap.groovy, I put some println statements at the top of the init action, but those aren't printing out and don't seem to even be reached. Finally, I did an uninstall of the plugin, and after that, deleted the shopping-cart plugin folder manually.

Do you know what this error is, or have any debug guidance? (am running Grails 1.3.7)

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

2011-12-09 13:51:33,036 [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 org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type within the [mapping] block or use a basic type (String, Integer etc.) 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 org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type within the [mapping] block or use a basic type (String, Integer etc.) at org.grails.tomcat.TomcatServer.startSecure(TomcatServer.groovy:289) at grails.web.container.EmbeddableServer$startSecure.call(Unknown Source) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:152) 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_closure2.doCall(_GrailsRun_groovy:66) at RunApp$_run_closure1.doCall(RunApp.groovy:30) 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 org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type within the [mapping] block or use a basic type (String, Integer etc.) ... 24 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type within the [mapping] block or use a basic type (String, Integer etc.) ... 24 more Caused by: org.hibernate.MappingException: Type [null] is not a basic type or a domain class and cannot be mapped. Either specify a type within the [mapping] block or use a basic type (String, Integer etc.) ... 24 more

Process finished with exit code 1

Upvotes: 0

Views: 7138

Answers (2)

Ramesh
Ramesh

Reputation: 416

I would guess that you have a problem in one of your domain classes where you use a "def" or some other invalid type in the domain class for one of the fields.

Upvotes: 0

Ray
Ray

Reputation: 6115

I removed all the new domain classes and references to them, and the error went away. I'll update this as soon as I figure out what the problem is, hopefully not related to a domain change to one of the Spring Security classes (User).

Ok, the problem is/was, I had an enum declaration at the top of one of the domain classes I added. If I move the enum declaration below the class declaration, then all is good. I imagine this is a hibernate error / problem?

Upvotes: 2

Related Questions