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

Null key returned for cache operation and Parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag. #32715

Closed
manjinderrooprai opened this issue Apr 26, 2024 · 2 comments
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@manjinderrooprai
Copy link

manjinderrooprai commented Apr 26, 2024

On updating our application to Spring Boot 3.2.5 and Spring framework 6.1.6. we are getting following Errors.

ERROR c.a.s.t.c.e.ControllerExceptionHandler - java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.
java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.
ERROR c.a.s.t.c.e.ControllerExceptionHandler - java.lang.IllegalArgumentException: Null key returned for cache operation  caches=['cacheExample'] | key='#cacheKey' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='true']. If you are using named parameters, ensure that the compiler uses the '-parameters' flag.
java.lang.IllegalArgumentException: Null key returned for cache operation  caches=['cacheExample'] | key='#cacheKey' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='true']. If you are using named parameters, ensure that the compiler uses the '-parameters' flag.

It seams, it is asking to compile(java) code with '-parameters' flag. So for that, I have followed the directions on https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention:

I have added:

tasks.withType(JavaCompile).configureEach {
    options.compilerArgs.add("-parameters")
}

Even i had tried adding following mentioned in Thread: #31729

 tasks.withType(JavaCompile) {
        configure(options) {
            options.compilerArgs << '-parameters'
        }
    }

Nothing works for me.

I am using Vscode 1.88.1 with following configuration:
springBootVersion= 3.2.5
springFrameworkVersion= 6.1.6
Java= 17.0.5
gradle= 8.7

Could you please help me in resolving this issue.

Affects: <Spring Framework version>


@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 26, 2024
@snicoll
Copy link
Member

snicoll commented Apr 26, 2024

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
@snicoll snicoll added for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 26, 2024
@manjinderrooprai

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

3 participants