Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Migration from Grails 2.3.5 to Grails 3.1.1 with MongoDB plugin #654

Closed
hemavidal opened this issue Feb 18, 2016 · 6 comments
Closed

Comments

@hemavidal
Copy link

Hello grails team,

i have an issue when i started the migrating process from 2.3.5 to 3.1.1:

ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Either class [com.MyClass] is not a domain class or GORM has not been initialized correctly or has already been shutdown. If you are unit testing your entities using the mocking APIs
at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:159) ~[grails-datastore-gorm-5.0.1.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEnhancer.findInstanceApi(GormEnhancer.groovy:165) ~[grails-datastore-gorm-5.0.1.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEnhancer.findInstanceApi(GormEnhancer.groovy) ~[grails-datastore-gorm-5.0.1.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormInstanceApi(GormEntity.groovy:1311) ~[grails-datastore-gorm-5.0.1.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:87) ~[grails-datastore-gorm-5.0.1.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper$save$0.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-2.4.5.jar:2.4.5]
at saff.MyClass.save(MyClass.groovy) ~[main/:na]
at saff.MyClass.save(MyClass.groovy) ~[main/:na]
at org.grails.datastore.gorm.GormEntity$save.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) [groovy-2.4.5.jar:2.4.5]
at BootStrap$_closure1.doCall(BootStrap.groovy:45) ~[main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73]
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) ~[springloaded-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1084) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.Closure.call(Closure.java:426) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.Closure.call(Closure.java:420) ~[groovy-2.4.5.jar:2.4.5]
at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:434) ~[grails-bootstrap-3.1.1.jar:3.1.1]
at grails.util.Environment.executeForEnvironment(Environment.java:427) ~[grails-bootstrap-3.1.1.jar:3.1.1]
at grails.util.Environment.executeForCurrentEnvironment(Environment.java:403) ~[grails-bootstrap-3.1.1.jar:3.1.1]
at org.grails.web.servlet.boostrap.DefaultGrailsBootstrapClass.callInit(DefaultGrailsBootstrapClass.java:62) ~[grails-web-3.1.1.jar:3.1.1]
at org.grails.web.servlet.context.GrailsConfigUtils.executeGrailsBootstraps(GrailsConfigUtils.java:65) ~[grails-web-3.1.1.jar:3.1.1]
at org.grails.plugins.web.servlet.context.BootStrapClassRunner.onStartup(BootStrapClassRunner.groovy:53) ~[grails-plugin-controllers-3.1.1.jar:3.1.1]
at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy:238) ~[grails-core-3.1.1.jar:3.1.1]
at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy) ~[grails-core-3.1.1.jar:3.1.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at grails.boot.GrailsApp.run(GrailsApp.groovy:55) [grails-core-3.1.1.jar:3.1.1]
at grails.boot.GrailsApp.run(GrailsApp.groovy:347) [grails-core-3.1.1.jar:3.1.1]
at grails.boot.GrailsApp.run(GrailsApp.groovy:336) [grails-core-3.1.1.jar:3.1.1]
at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-3.1.1.jar:3.1.1]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [groovy-2.4.5.jar:2.4.5]
at saff.Application.main(Application.groovy:8) [main/:na]

My Domain classes are the same of the Grails 2.3.5 project.
I'm using the mongodb plugin.

build.gradle.txt
MyClass.groovy.txt

@hemavidal hemavidal changed the title Error in Migration of Grails 2.3.5 to Grails 3.1.1 with MongoDB plugin Error in Migration from Grails 2.3.5 to Grails 3.1.1 with MongoDB plugin Feb 18, 2016
@graemerocher
Copy link
Member

Cannot reproduce this, please upload an example that reproduces the issue

@hemavidal
Copy link
Author

This issue was resolved!

@hemavidal
Copy link
Author

The problem was in Grails + MongoDB + GMongo(Excluded in grails 3)

@hemavidal
Copy link
Author

I Added a declaration: def mongo in each Controller/Service that uses GMongo API.

@rkimaoui
Copy link

rkimaoui commented Sep 9, 2016

Hello hemavidal,
Which Gmongo version do you use ?
I can't make it work with: Grails 3.1.11 and mongodb:5.0.10 and com.gmongo:gmongo:1.5

@hemavidal
Copy link
Author

Thats right now!
I've declared the gmongo separately.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants