Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install instructions don't work for Grails 5.1.6 #740

Closed
monetschemist opened this issue Apr 6, 2022 · 9 comments
Closed

Install instructions don't work for Grails 5.1.6 #740

monetschemist opened this issue Apr 6, 2022 · 9 comments

Comments

@monetschemist
Copy link

Expected Behavior

The 5.0.0-RC1 install instructions are to add this line to dependencies in build.gradle:

https://grails.github.io/grails-spring-security-core/5.0.0-RC1/index.html#tutorials

compile 'org.grails.plugins:spring-security-core:5.0.0-RC1'

and then do a grails compile followed by configuration.

Actual Behaviour

The grails compile fails with the following message:


FAILURE: Build failed with an exception.

* Where:
Build file '/home/clh/src/Grails5/wrm/build.gradle' line: 76

* What went wrong:
A problem occurred evaluating root project 'wrm'.
> Could not find method compile() for arguments [org.grails.plugins:spring-security-core:5.0.0-RC1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE FAILED in 5s

It may be the case that in Grails 5.1.6 compile has been replaced with compileOnly - by using this line in dependencies {}

compileOnly 'org.grails.plugins:spring-security-core:5.0.0-RC1'

the grails compile step works but still emits the deprecated warning. And as for that, I cannot get any combo of --warning-mode all to produce anything useful.

Steps To Reproduce

Grails 5.1.6 JVM 11.0.12 from SDK install brand new application created with grails create-app wrm

follow Grails Spring Security Core Plugin install instructions here:

https://grails.github.io/grails-spring-security-core/5.0.0-RC1/index.html#tutorials

problem outcome as described above in Actual Behaviour

Environment Information

  • JDK 11.0.12 from SDK install
  • Ubuntu 21.10

Example Application

No response

Version

5.1.6

@monetschemist
Copy link
Author

Subsequently the grails s2-quickstart fails as well with the following message:


| Error Command not found s2-quickstart
Did you mean: stats or war or stop?

@monetschemist
Copy link
Author

I subsequently tried this with Grails 5.0.3 and the same problems occurred.

@puneetbehl
Copy link
Contributor

Could you please try adding the dependency as:

implementation("org.grails.plugins:spring-security-core:5.0.0-RC1")

@monetschemist
Copy link
Author

Good morning @puneetbehl This morning, using the following environment:

grails 5.1.6
groovy 3.0.8
java 11.0.12-open

I ran the following:

grails create-app test

which responded

| Application created at /home/clh/src/Grails5/test

Then I cd'ed into the folder test (just created), edited build.gradle adding the line

implementation "org.grails.plugins:spring-security-core:5.0.0-RC1"

at the bottom of the dependencies section

Then I ran:

grails s2-quickstart test User Role

which resulted in:

| Resolving Dependencies. Please wait...

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE SUCCESSFUL in 6s
| Creating User class 'User' and Role class 'Role' in package 'test'
| Rendered template PersonWithoutInjection.groovy.template to destination grails-app/domain/test/User.groovy
| Rendered template PersonPasswordEncoderListener.groovy.template to destination src/main/groovy/test/UserPasswordEncoderListener.groovy
| Rendered template Authority.groovy.template to destination grails-app/domain/test/Role.groovy
| Rendered template PersonAuthority.groovy.template to destination grails-app/domain/test/UserRole.groovy
| 
************************************************************
* Created security-related domain classes. Your            *
* grails-app/conf/application.groovy has been updated with *
* the class names of the configured domain classes;        *
* please verify that the values are correct.               *
************************************************************

Then I ran

grails run-app

which resulted in:

| Running application...

Configuring Spring Security Core ...
... finished configuring Spring Security Core

2022-04-13 09:52:58.323 ERROR --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeViewResolver': Unsatisfied dependency expressed through field 'viewResolvers'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jspViewResolver': Cannot create inner bean '(inner bean)#62e9a31d' of type [grails.plugin.scaffolding.ScaffoldingViewResolver] while setting bean property 'innerViewResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#62e9a31d': Cannot resolve reference to bean 'groovyPagesTemplateEngine' while setting bean property 'templateEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'classLoader' of bean class [org.grails.gsp.GroovyPagesTemplateEngine]: Bean property 'classLoader' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:485)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:472)
        at test.Application.main(Application.groovy:11)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jspViewResolver': Cannot create inner bean '(inner bean)#62e9a31d' of type [grails.plugin.scaffolding.ScaffoldingViewResolver] while setting bean property 'innerViewResolver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#62e9a31d': Cannot resolve reference to bean 'groovyPagesTemplateEngine' while setting bean property 'templateEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'classLoader' of bean class [org.grails.gsp.GroovyPagesTemplateEngine]: Bean property 'classLoader' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:389)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1607)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1571)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1460)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1347)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
        ... 26 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#62e9a31d': Cannot resolve reference to bean 'groovyPagesTemplateEngine' while setting bean property 'templateEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'classLoader' of bean class [org.grails.gsp.GroovyPagesTemplateEngine]: Bean property 'classLoader' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:374)
        ... 42 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'classLoader' of bean class [org.grails.gsp.GroovyPagesTemplateEngine]: Bean property 'classLoader' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1744)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)
        ... 48 common frames omitted
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'classLoader' of bean class [org.grails.gsp.GroovyPagesTemplateEngine]: Bean property 'classLoader' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243)
        at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:432)
        at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:278)
        at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:266)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:79)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1740)
        ... 56 common frames omitted

Which doesn't seem right to me.

@fernando88to
Copy link

The solution is grails/grails-core#12460

@monetschemist
Copy link
Author

@fernando88to just to confirm - you're suggesting do this:

upgrade Spring by using spring.version=5.3.19 in my gradle.properties files, it runs

¿correct?

@fernando88to
Copy link

yes

@puneetbehl
Copy link
Contributor

This should be resolved with Grails 5.1.7

@monetschemist
Copy link
Author

@puneetbehl @fernando88to my apologies for the delay in responding.

I confirm that with the build environment:

  • java 11.0.12open
  • grails 5.1.7

(installed from SDKMAN)

and with the line

implementation "org.grails.plugins:spring-security-core:5.0.0-RC1"

added to build.gradle

and with the line

spring.version=5.3.19

added to gradle.properties

the command

grails s2quickstart test User Role

runs successfully. I still get the warning message:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

I believe the documentation for §26.1.2. 2. “Install” the plugin by adding it to build.gradle needs to be updated to reflect the changes necessary to build.gradle and gradle.properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants