Error "Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either"with spring 3.2 upgrade
Asked Answered
D

4

5

After upgrading my code from Java 17 and Spring-boot 3.1.3 to Java 21 and String-boot 3.2.0, I've started to see errors like the ones below, when calling the REST APIs:

UPDATE: After running some more tests, using different spring-boot versions with Java 21, I can tell that the problem is only visible with spring-boot 3.2.0.
The system works fine if I use spring-boot 3.1.6 with Java 21.

Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either.

Name for argument of type [java.lang.String] not specified, and parameter name information not found in class file either.

Name for argument of type [java.lang.Integer] not specified, and parameter name information not found in class file either.

Any idea what is going on? Is there a spring-boot glitch as it seem to have had occurred in the past? https://github.com/spring-projects/spring-loaded/issues/68

Thanks

PS: the code was working ok before doing this upgrade. Nothing else changed but the Java version and the Spring version.

are_1         | 2023-12-10T18:04:38.962Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} DEBUG: [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolverrlf(Using @ExceptionHandler com.kp.mw.exceptions.RestExceptionHandler#handleCustomException(Exception)) 
middleware_1         | 2023-12-10T18:04:38.966Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} ERROR: [com.kp.mw.exceptions.RestExceptionHandler] com.kp.mw.exceptions.RestExceptionHandlerrlf(Exception occurred:java.lang.IllegalArgumentException: Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either.
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.updateNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:183)
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.getNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:160)
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:106)
middleware_1         |  at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
middleware_1         |  at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:218)
middleware_1         |  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:171)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829)
middleware_1         |  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
middleware_1         |  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
middleware_1         |  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
middleware_1         |  at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
middleware_1         |  at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at com.kp.mw.filters.AuthorizationFilter.doFilter(AuthorizationFilter.java:36)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
middleware_1         |  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
middleware_1         |  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
middleware_1         |  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
middleware_1         |  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
middleware_1         |  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
middleware_1         |  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
middleware_1         |  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
middleware_1         |  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
middleware_1         |  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
middleware_1         |  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
middleware_1         |  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
middleware_1         |  at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
middleware_1         |  at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
middleware_1         |  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
middleware_1         |  at java.base/java.lang.Thread.run(Thread.java:1583)
middleware_1         | ) 
middleware_1         | 2023-12-10T18:04:38.976Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} DEBUG: [org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor] org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessorrlf(Using 'text/plain', given [*/*] and supported [text/plain, */*, application/json, application/*+json]) 
middleware_1         | 2023-12-10T18:04:38.976Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} DEBUG: [org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor] org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessorrlf(Writing ["{"message":"An unexpected error has occurred"}"]) 
lb_1                 | 172.18.0.1 - - [10/Dec/2023:18:04:38 +0000] "GET /product/d9ede6d3-c262-4fc6-b764-cdd4e229f841?ignoreView=true&web HTTP/1.1" 500 46 "http://localhost/?editProductId=d9ede6d3-c262-4fc6-b764-cdd4e229f841&locale=en" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
middleware_1         | 2023-12-10T18:04:38.981Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} DEBUG: [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolverrlf(Resolved [java.lang.IllegalArgumentException: Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either.]) 
middleware_1         | 2023-12-10T18:04:38.982Z <> {thread=http-nio-8080-exec-7} {traceId=7d292d7bef196d7b46db97bff2e7ca0c} {spanId=bba4492c71a85d94} DEBUG: [org.springframework.web.servlet.DispatcherServlet] org.springframework.web.servlet.DispatcherServletrlf(Completed 500 INTERNAL_SERVER_ERROR) 
middleware_1         | 2023-12-10T18:04:38.984Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.SqlSessionUtils] org.mybatis.spring.SqlSessionUtilsrlf(Creating a new SqlSession) 
middleware_1         | 2023-12-10T18:04:38.984Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.SqlSessionUtils] org.mybatis.spring.SqlSessionUtilsrlf(SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3b6970da] was not registered for synchronization because synchronization is not active) 
middleware_1         | 2023-12-10T18:04:38.984Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.springframework.jdbc.datasource.DataSourceUtils] org.springframework.jdbc.datasource.DataSourceUtilsrlf(Fetching JDBC Connection from DataSource) 
middleware_1         | 2023-12-10T18:04:38.985Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.transaction.SpringManagedTransaction] org.mybatis.spring.transaction.SpringManagedTransactionrlf(JDBC Connection [io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryConnection@5342b636] will not be managed by Spring) 
middleware_1         | 2023-12-10T18:04:38.985Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrors] com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrorsrlf(==>  Preparing: SELECT ir.* FROM errors.ignorable_errors ir) 
middleware_1         | 2023-12-10T18:04:38.985Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrors] com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrorsrlf(==> Parameters: ) 
middleware_1         | 2023-12-10T18:04:38.989Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrors] com.kp.mw.db.mappers.ErrorsMapper.getIgnoreErrorsrlf(<==      Total: 0) 
middleware_1         | 2023-12-10T18:04:38.990Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.SqlSessionUtils] org.mybatis.spring.SqlSessionUtilsrlf(Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3b6970da]) 
middleware_1         | 2023-12-10T18:04:38.992Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.SqlSessionUtils] org.mybatis.spring.SqlSessionUtilsrlf(Creating a new SqlSession) 
middleware_1         | 2023-12-10T18:04:38.992Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.SqlSessionUtils] org.mybatis.spring.SqlSessionUtilsrlf(SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bd9d594] was not registered for synchronization because synchronization is not active) 
middleware_1         | 2023-12-10T18:04:38.992Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.springframework.jdbc.datasource.DataSourceUtils] org.springframework.jdbc.datasource.DataSourceUtilsrlf(Fetching JDBC Connection from DataSource) 
middleware_1         | 2023-12-10T18:04:38.993Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [org.mybatis.spring.transaction.SpringManagedTransaction] org.mybatis.spring.transaction.SpringManagedTransactionrlf(JDBC Connection [io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryConnection@5b468f95] will not be managed by Spring) 
middleware_1         | 2023-12-10T18:04:38.993Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [com.kp.mw.db.mappers.ErrorsMapper.createError] com.kp.mw.db.mappers.ErrorsMapper.createErrorrlf(==>  Preparing: INSERT INTO errors.errors (id, username, method, url, urlRegex, body, signature, error_stack, error_message, ip, creation_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)) 
middleware_1         | 2023-12-10T18:04:38.994Z <> {thread=persist-error-thread} {traceId=} {spanId=} DEBUG: [com.kp.mw.db.mappers.ErrorsMapper.createError] com.kp.mw.db.mappers.ErrorsMapper.createErrorrlf(==> Parameters: 8e69ba03-6cd9-430e-b30a-db5cca540298(UUID), null, getProduct(String), http://localhost/product/d9ede6d3-c262-4fc6-b764-cdd4e229f841?ignoreView=true&web(String), /product/[0-9a-zA-Z-]{1,}(String), null, 108b9713a0c70e4d7add7ec76789995be8c5689790dd99f1a6eee2ef3b4017be(String), java.lang.IllegalArgumentException: Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either.
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.updateNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:183)
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.getNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:160)
middleware_1         |  at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:106)
middleware_1         |  at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
middleware_1         |  at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:218)
middleware_1         |  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:171)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917)
middleware_1         |  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829)
middleware_1         |  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
middleware_1         |  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
middleware_1         |  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
middleware_1         |  at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564)
middleware_1         |  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
middleware_1         |  at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at com.kp.mw.filters.AuthorizationFilter.doFilter(AuthorizationFilter.java:36)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
middleware_1         |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
middleware_1         |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
middleware_1         |  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
middleware_1         |  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
middleware_1         |  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
middleware_1         |  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
middleware_1         |  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
middleware_1         |  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
middleware_1         |  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
middleware_1         |  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
middleware_1         |  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
middleware_1         |  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
middleware_1         |  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
middleware_1         |  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
middleware_1         |  at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
middleware_1         |  at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
middleware_1         |  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
middleware_1         |  at java.base/java.lang.Thread.run(Thread.java:1583)
middleware_1         | (String), Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either.(String), 172.18.0.1(String)) 
middleware_1         | 2023-12-10T18:04:39.009Z <> {thread=http-nio-8080-exec-8} {traceId=} {spanId=} DEBUG: [io.micrometer.tracing.otel.propagation.BaggageTextMapPropagator] io.micrometer.tracing.otel.propagation.BaggageTextMapPropagatorrlf(Will propagate new baggage context for entries {}) 
middleware_1         | 2023-12-10T18:04:39.010Z <> {thread=http-nio-8080-exec-8} {traceId=bbf381b8fdee086f923ab2cec5764629} {spanId=cff2129fcd91a697} DEBUG: [org.springframework.web.servlet.DispatcherServlet] org.springframework.web.servlet.DispatcherServletrlf(GET "/system/alerts/active?web", paramet

My maven compile plugin configuration:

......
 <properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <java.version>21</java.version>
    <springboot.version>3.2.0</springboot.version>
......
 <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${springboot.version}</version>
            <executions>
              <execution>
                <configuration>
                  <classifier>exec</classifier>
                  <finalName>${project.artifactId}</finalName>
                </configuration>
                <goals>
                  <goal>repackage</goal>
                </goals>
              </execution>
              <execution>
                <id>build-info</id>
                <goals>
                    <goal>build-info</goal>
                </goals>
            </execution>
            </executions>
          </plugin>
......
Dyslexia answered 10/12, 2023 at 18:34 Comment(0)
A
4

Any idea what is going on?

Some meta-tool (such as an annotation processor; something that either directly inspects class files, or uses reflection to attempt to glean info from your classes based not on implementing methods in interfaces and classes, but on structure alone - such as 'any method that starts with the letters get') requires the names of parameters to do its job.

However, java-the-language is set up so that param names are irrelevant, and as a consequence, in basic java (as in, compiling without any flags for old versions of java), they were not included whatsoever in your class files - if you write:

public void foo(String x, int y) {}

Then what ends up in the class file is:

  • public, yes, as a flag.
  • The identity string foo(Ljava/lang/String;I)V.
  • That string contains void (V), and both param types (String, and I is for int), and of course the method name. But not x or y.

Because param names come in handy for all sorts of things, these days java compilers tend to include that information by default. But the basic language design does not need them to exist (as an example, in java, it is not possible to e.g. call that as foo(x: "Hi", y: 5) - in many languages you can do that, in java, you cannot.

For whatever reason, class files you have obtained no longer include this information.

There are a few explanations:

  • compile, passing -g:vars to javac. You may have to investigate how to tell your build tool to do this. This tells the build tool to include debug symbols for variable names. This includes method param names. This works on every javac, but, you should probably instead use...
  • The -parameters option which is new, and a better way to do this.

if you're using maven, looks something like:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
...
<configuration>
  <release>21</release>
  <compilerArgs>
    <arg>-parameters</arg>
  </compilerArgs>
</configuration>

Exactly which class file is missing method param names - that's not clear from your paste, unfortunately.

You can check whether they have it using reflection:

System.out.println(
  String.class.getMethod("charAt", int.class).getParameters()[0].getName()
);

This prints 'arg0', which is what .getName() ends up doing when this information is not present. So, my JDK doesn't have them in the core libs.

A second way to figure this out is with javap, the decompiler. It shows arg names - if it shows arg0, arg1, and so forth, it's not included. If it shows an actual name, it is, and that meta tool that is throwing those errors can process those files.

Afrika answered 10/12, 2023 at 18:49 Comment(4)
thanks for your reply! I'm actually using spring-boot-maven-plugin in my project. From what I can find on google about this plugin, it seems I have to inherit the spring-boot-starter-parent to get the -parameters compiler argument passed (docs.spring.io/spring-boot/docs/current/maven-plugin/reference/…). So I did that but after re-compiling , when I start my application, I get almost immediately a StackOverflow exceptionDyslexia
Error looks like this: Caused by: java.lang.reflect.InvocationTargetException middleware_1 | ... 1024 more middleware_1 | Caused by: java.lang.StackOverflowError middleware_1 | at java.base/sun.nio.fs.UnixPath.<init>(UnixPath.java:76) middleware_1 | at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:312) middleware_1 | at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1445) middleware_1 | at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:724)Dyslexia
I've run a couple of more tests and it seems the problem shows up only when I'm using spring-boot version 3.2.0. With spring-boot 3.1.6 and java 21, everything is OK. So it looks to me like a spring 3.2.0 problem. I will update the title and tags accordinglyDyslexia
OK it seems this behavior is a new "feature" in spring-boot 3.2.0 github.com/spring-projects/spring-boot/wiki/… . As rzwitserloot metined I will have to find a way that actually works, to pass the "parameters" option to the spring-boot-maven-pluginDyslexia
D
3

The solution for my scenario was to add the following maven compiler plugin section into my pom:

 <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.11.0</version>
        <configuration>
            <parameters>true</parameters>
        </configuration>
    </plugin>
Dyslexia answered 11/12, 2023 at 13:20 Comment(0)
G
0

I also encountered this issue while upgrading from Spring Boot 3.0 to 3.2 (Java 17). No need to add anything to the complete answer above, but just wanted to share the Gradle snippet to use:

apply plugin: 'java'

compileJava {
    options.compilerArgs << '-parameters'
}
Genvieve answered 28/2 at 8:12 Comment(0)
G
0

Sometimes it is also necessary to manually configure your IDE.

In IntelliJ IDEA, open Settings and add -parameters to the following field.

Build, Execution, Deployment → Compiler → Java Compiler → Additional command line parameters

In Eclipse IDE, open Preferences and activate the following checkbox.

Java → Compiler → Store information about method parameters (usable via reflection)

In VSCode, edit or add the .settings/org.eclipse.jdt.core.prefs file with the following content:

org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
Gautama answered 3/10 at 17:12 Comment(1)
Markdown Editing HelpLodmilla

© 2022 - 2024 — McMap. All rights reserved.