Why did Grails 4.0.10 run-app behavior change overnight?

57 Views Asked by At

I am suddenly getting a conflict between a class in a Grails plugin and the same class in a Grails plugin.

Grails Notification plugin has a skeleton User class defined in order to provide for stand-alone plugin testing. The User class is defined with the same package as the real User class in the main app. The plugin User class is NOT published with the plugin - it is excluded from the jar. In any case, the app class should predominate, and there is no runtime warning about duplicate classes. The plugin User class is there in the plugin sources jar, however. This has always worked fine - until now.

So, not only am I mystified, I'm also worried because we also include a number of duplicatively defined utility classes that are also excluded from the plugin jars - will those also be a problem?

Important: this problem was not there yesterday! Overnight corporate security applied some updates and forced a restart on our computers, so Intellij in particular had to be reopened. A colleague can duplicate this same new behavior on his machine, so it's not a local cache problem on my computer - pointing to a common code or build problem? We are running run-app via the Intellij IDE, but invoking run-app from a cmdline exhibits the same problem.

    // This Grails debug console code
    import com.penbaymedia.jdeis5.notification.service.EmailService // just to check existence
    
    def svc = ctx.getBean('emailService')   // in Grails Notification plugin
    
    def user = User.findByUsername('jphiloon')  // User defined in main app and in plugin
    
    svc.getEmail(user)
    
    /* Responds with this result:
    groovy.lang.MissingMethodException: No signature of method: com.penbaymedia.jdeis5.notification.service.EmailService.getEmail() is applicable for argument types: (com.penbaymedia.jdeis5.domainobject.User) values: [com.penbaymedia.jdeis5.domainobject.User : 5265]
    Possible solutions: getEmail(com.penbaymedia.jdeis5.domainobject.User), getClass(), sendMail(groovy.lang.Closure)
    The following classes appear as argument class and as parameter class, but are defined by different class loader:
    com.penbaymedia.jdeis5.domainobject.User (defined by 'org.springframework.boot.devtools.restart.classloader.RestartClassLoader@1378323c' and 'sun.misc.Launcher$AppClassLoader@18b4aac2')
    If one of the method suggestions matches the method you wanted to call, 
    then check your class loader setup.
    */

/* The error shown in the application run-app console is a bit different, but unproxying the User object does not help:
2022-03-02 11:20:00,270 ERROR com.penbaymedia.jdeis5.job.AssignmentNotificationIntervalJob - No signature of method: com.penbaymedia.jdeis5.notification.service.EmailService.getEmail() is applicable for argument types: (com.penbaymedia.jdeis5.domainobject.User$HibernateProxy$hgS4G0mO) values: [<com.penbaymedia.jdeis5.domainobject.User$HibernateProxy$hgS4G0mO@9c96547>]
Possible solutions: getEmail(com.penbaymedia.jdeis5.domainobject.User), getClass(), sendMail(groovy.lang.Closure)
*/
0

There are 0 best solutions below