iamthechad / grails3-recaptcha

ReCaptcha plugin for Grails 3
Other
3 stars 10 forks source link

Add Support for Grails 4 #36

Closed dustindclark closed 4 years ago

dustindclark commented 5 years ago

Installing version 3.2.0 in a Grails 4 app keeps the app from starting. The error is java.lang.NoClassDefFoundError: org/grails/core/cfg/DeprecatedGrailsConfig. Recaptcha is not in the stack trace, but I've attached it below anyways. Removing recaptcha 3.2.0 allows the app to start again.

I will report back if I find a workaround.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'convertersConfigurationInitializer': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.grails.web.converters.configuration.ConvertersConfigurationInitializer] from ClassLoader [sun.misc.Launcher$AppClassLoader@659e0bfd]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:97)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:458)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:445)
    at myapp.Application.main(Application.groovy:11)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.grails.web.converters.configuration.ConvertersConfigurationInitializer] from ClassLoader [sun.misc.Launcher$AppClassLoader@659e0bfd]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248)
    ... 24 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/grails/core/cfg/DeprecatedGrailsConfig
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)
    ... 27 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.grails.core.cfg.DeprecatedGrailsConfig
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 31 common frames omitted
dustindclark commented 5 years ago

Looks like a problem with the grails converter plugin. I took a stab at building a version of this plugin that would compile and run with both Grails 3 and Grails 4 to no avail. As a workaround, explicitly adding a converters dependency in the Grails 4 app resolves this issue:

compile "org.grails.plugins:converters"
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dustindclark commented 4 years ago

This is still a problem. I run into it still while upgrading 3.x apps/plugins to 4.0. Can we reopen?