Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: Grails-Acegi 0.5
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
I have tried to isolate the problem down to the failing line and here is what I gleaned on my system. BTW, this happens on Mac OSX and Fedora 10 for me (the only systems that I have).
The issue has to do with the presence of an Enum class in my Domain class file and with the Acegi Plugin. I do not know the details of Spring Security so I need some help to take this issue further.
The two scenarios I created is as follows:
1) Works: Domain class contains the Enum class as well, but NO Acegi plugin
2) Fails: Domain class contains the Enum class as well, and Acegi plugin is installed.
2) Works: Domain class does NOT contain the Enum class, and Acegi plugin is installed.
Also, enabling and disabling the security via the SecurityConfig.groovy does not make any difference.
Note that this problem occurs on Grails 1.1.1 as well as 1.2-M2 and 1.2-M3 (these are the only ones I have tried).
Also note that if I move the Enum class to a different file, this problem goes away (work around for me).
I am attaching two zip files. One with and one without Acegi for you to see the difference.
- Tosh
===============================================================================
Welcome to Grails 1.2-M3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails-1.2-M3
Base Directory: /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException
Resolving dependencies...
Dependencies resolved in 937ms.
Running script /usr/local/grails-1.2-M3/scripts/RunApp.groovy
Environment set to development
[copy] Copied 9 empty directories to 5 empty directories under /Users/tosh/.grails/1.2-M3/projects/mappingException/resources
[copy] Copied 1 empty directory to 1 empty directory under /Users/tosh/.grails/1.2-M3/projects/mappingException/resources
[copy] Copied 2 empty directories to 2 empty directories under /Users/tosh/.grails/1.2-M3/projects/mappingException/resources
[mkdir] Created dir: /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException/target/classes
[groovyc] Compiling 38 source files to /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException/target/classes
Note: /Users/tosh/.grails/1.2-M3/projects/mappingException/plugins/acegi-0.5.2/src/java/org/codehaus/groovy/grails/plugins/springsecurity/ldap/GrailsLdapUser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[groovyc] Compiling 13 source files to /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException/target/classes
[mkdir] Created dir: /Users/tosh/.grails/1.2-M3/projects/mappingException/resources/grails-app/i18n
[native2ascii] Converting 12 files from /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException/grails-app/i18n to /Users/tosh/.grails/1.2-M3/projects/mappingException/resources/grails-app/i18n
[copy] Copying 1 file to /Users/tosh/MySoftware/Eclipse/grails-12M3/mappingException/target/classes
[copy] Copied 2 empty directories to 2 empty directories under /Users/tosh/.grails/1.2-M3/projects/mappingException/resources
Running Grails application..
[active=false] Spring Security not loaded
2009-10-05 17:08:47,299 [main] ERROR context.ContextLoader - Context initialization failed
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.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3961)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4456)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:515)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:708)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:252)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:115)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:155)
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:273)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:147)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:113)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:57)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
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.)
... 32 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.)
... 32 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.)
... 32 more
2009-10-05 17:08:47,301 [main] ERROR [localhost].[/mappingException] - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
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.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3961)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4456)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:515)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:708)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:252)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:115)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:155)
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:273)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:147)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:113)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:57)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
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.)
... 32 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.)
... 32 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.)
... 32 more
2009-10-05 17:08:47,302 [main] ERROR core.StandardContext - Error listenerStart
2009-10-05 17:08:47,317 [main] ERROR core.StandardContext - Context [/mappingException] startup failed due to previous errors
Server running. Browse to http://localhost:8080/mappingException
Another simliar error message that is caused by this problem is:
Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: DomainWithEnum, at table: other_domain_assoc, for columns: [org.hibernate.mapping.Column(domain_with_enum)]
This was only a problem for me when moving from Grails 1.2-M2 to 1.2-M3.
The workaround stated above also works for me.