Grails 4.0.2 gradle runCommand - exception regarding "domain class defined by different class loader: "

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Grails 4.0.2 gradle runCommand - exception regarding "domain class defined by different class loader: "

Milan Zimmermann
Hi, I am still converting our application from Grails 2.2.0 to 4.0.2

After many many issues solved, I am getting into areas that make me very desperate .. but anyway.

We have some grails scripts (used to run as 'grails run-script') that have lots of database processing, domain classes etc.

Running 

./gradlew runCommand ...-Pargs="load-activity-facts myApp.Application"

I am getting exceptions that go like this:


Command execution error: No signature of method: myOrg.ProcedureSet$_buildUniqueKeyFromProcTypes_closure1.doCall() is applicable for argument types: (myOrg.ServicedCaseProcedureType) values: [myOrg.ServicedCaseProcedureType : (unsaved)]
Possible solutions: doCall(myOrg.ServicedCaseProcedureType), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
The following classes appear as argument class and as parameter class, but are defined by different class loader:
myOrg.ServicedCaseProcedureType (defined by 'org.springframework.boot.devtools.restart.classloader.RestartClassLoader@62a122fb' and 'sun.misc.Launcher$AppClassLoader@39a054a5')
If one of the method suggestions matches the method you wanted to call, 
then check your class loader setup.

Would anyone have any idea how to address it? I am not doing anything special in build.gradle, definitely not trying to manipulate classloaders. Yet, all lines that address, use, or return Domain objects in the code, clearly have some class issues. I was able to "resolve" it until now by removing any declaration of concrete domain members

Organization org // changed to "def org"

to get pass those issues.


But I think this last clearly shows there is a problem. I just have no idea where to start. 

My Command handle is like:

boolean handle() {
Account.withTransaction { // or withNewSession, either fails the same
readOrganizationFromEnviroment()
runActivityFacts()
}

return true
}


Anyone have any ideas?

Thank you

PS: I am guessing this is a better forum for this than Slack but can re-post

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/7c9fb48b-3877-46a0-b6a6-d8f4f8d393ae%40googlegroups.com.