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

40 views
Skip to first unread message

Milan Zimmermann

unread,
May 6, 2020, 5:19:46 PM5/6/20
to Grails Dev Discuss
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

Reply all
Reply to author
Forward
0 new messages