Skip to content

Grails 3.2.1 classloader issues with domain classes #10244

@gregopet

Description

@gregopet

I upgraded a Grails 3.0.9 application to Grails 3.2.1 (running on Oracle's Java 8) and have started getting interesting issues. I have a controller in which I fetch a List of objects (GORM + Hibernate 4): List<Interstitial> interstitials = Interstitial.list()

Later I want to extract some properties from them with def interstitialConfig = interstitials?.collect { Interstitial instance -> ...} and I get the following error:

MissingMethodException occurred when processing request: [GET] /api/ios/1/foo.json
No signature of method: foo.bar.MobileApplicationController$_foo_closure8.doCall() is applicable for argument types: (foo.bar.Interstitial) values: [foo.bar.Interstitial : 1]
Possible solutions: doCall(foo.bar.Interstitial), 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:
foo.bar.Interstitial (defined by 'org.springframework.boot.loader.LaunchedURLClassLoader@77459877' and 'grails.boot.config.tools.ClassPathScanner$ApplicationRelativeClassLoader@33f676f6')
If one of the method suggestions matches the method you wanted to call, 
then check your class loader setup..

The stacktrace ends at the line containing the collect so it didn't seem relevant, but I can paste it if it helps. The bug also only appears on a staging/production build, not in development - we're deploying using self contained JARs.

We're using quite a few plugins, prime suspects for this could be Spring Security, Joda Time + Jadira mappings, PostgreSQL extensions, Build Test Data, Quartz. I can list them all if it helps. I can try to prepare an application to reproduce the bug, but I can't get around to it before this evening at the earliest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions