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

Failed with Spring Boot 3.2.0-RC2 #140

Closed
hantsy opened this issue Nov 4, 2023 · 7 comments
Closed

Failed with Spring Boot 3.2.0-RC2 #140

hantsy opened this issue Nov 4, 2023 · 7 comments

Comments

@hantsy
Copy link

hantsy commented Nov 4, 2023

I tried to upgrade my example project to Spring Boot 3.2.0-RC2, all tests are failed with the following exceptions.

https://github.com/hantsy/spring-graphql-sample/tree/master/graphql-spqr

2023-11-04T23:23:59.931+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : POST "/graphql", parameters={}
2023-11-04T23:23:59.947+08:00 DEBUG 2860 --- [o-auto-1-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to io.leangen.graphql.spqr.spring.web.mvc.DefaultGraphQLController#executeJsonPost(GraphQLRequest, GraphQLRequest, Object)
2023-11-04T23:24:00.125+08:00 DEBUG 2860 --- [o-auto-1-exec-1] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest@3762172d]
2023-11-04T23:24:00.153+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.web.method.HandlerMethod             : Could not resolve parameter [1] in public java.lang.Object io.leangen.graphql.spqr.spring.web.GraphQLController.executeJsonPost(io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest,io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest,R): Cannot resolve parameter names for constructor public io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest(java.lang.String,java.lang.String,java.lang.String,java.util.Map)
2023-11-04T23:24:00.157+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : Failed to complete request: java.lang.IllegalStateException: Cannot resolve parameter names for constructor public io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest(java.lang.String,java.lang.String,java.lang.String,java.util.Map)
2023-11-04T23:24:00.159+08:00 ERROR 2860 --- [o-auto-1-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.IllegalStateException: Cannot resolve parameter names for constructor public io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest(java.lang.String,java.lang.String,java.lang.String,java.util.Map)] with root cause

java.lang.IllegalStateException: Cannot resolve parameter names for constructor public io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest(java.lang.String,java.lang.String,java.lang.String,java.util.Map)
	at org.springframework.util.Assert.state(Assert.java:97) ~[spring-core-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.beans.BeanUtils.getParameterNames(BeanUtils.java:641) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.validation.DataBinder.createObject(DataBinder.java:932) ~[spring-context-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.validation.DataBinder.construct(DataBinder.java:903) ~[spring-context-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.bind.ServletRequestDataBinder.construct(ServletRequestDataBinder.java:112) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.constructAttribute(ServletModelAttributeMethodProcessor.java:156) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:148) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:217) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:170) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[tomcat-embed-core-10.1.15.jar:6.0]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.0-RC2.jar:6.1.0-RC2]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.15.jar:6.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.0-RC2.jar:6.1.0-RC2]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.15.jar:10.1.15]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]

2023-11-04T23:24:00.336+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : "ERROR" dispatch for POST "/error", parameters={}
2023-11-04T23:24:00.337+08:00 DEBUG 2860 --- [o-auto-1-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2023-11-04T23:24:00.423+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2023-11-04T23:24:00.427+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing [{timestamp=Sat Nov 04 23:24:00 CST 2023, status=500, error=Internal Server Error, path=/graphql}]
2023-11-04T23:24:00.503+08:00 DEBUG 2860 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : Exiting from "ERROR" dispatch, status 500
2023-11-04T23:24:00.516+08:00 DEBUG 2860 --- [ctor-http-nio-2] o.s.w.r.f.client.ExchangeFunctions       : [543c887] [2e0b4058-1, L:/127.0.0.1:54112 - R:localhost/127.0.0.1:54109] Response 500 INTERNAL_SERVER_ERROR
2023-11-04T23:24:00.558+08:00 ERROR 2860 --- [    Test worker] o.s.t.w.reactive.server.ExchangeResult   : Request details for assertion failure:

> POST http://localhost:54109/graphql
> accept-encoding: [gzip]
> user-agent: [ReactorNetty/1.1.12]
> host: [localhost:54109]
> WebTestClient-Request-Id: [1]
> Content-Type: [application/json]
> Accept: [application/json]
> Content-Length: [129]

{"variables":{},"query":"query {\n  allPosts{\n    id\n    title\n    content\n    comments{content}\n    author{email}\n  }\n}"}

< 500 INTERNAL_SERVER_ERROR Internal Server Error
< Vary: [Origin, Access-Control-Request-Method, Access-Control-Request-Headers]
< Content-Type: [application/json]
< Transfer-Encoding: [chunked]
< Date: [Sat, 04 Nov 2023 15:24:00 GMT]
< Connection: [close]

{"timestamp":"2023-11-04T15:24:00.402+00:00","status":500,"error":"Internal Server Error","path":"/graphql"}
@krs23
Copy link

krs23 commented Nov 13, 2023

Same issue for us!

@lewimuchiri
Copy link

lewimuchiri commented Nov 27, 2023

Observing the same in Spring Boot 3.2.0

@guofengzh
Copy link

Just met the same issue in Spring Boot 3.2.0. From the thrown error, making the following changes resolved the issue (tested against the main branch, 1.0.1-SNAPSHOT):

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <parameters>true</parameters>
                        <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    </configuration>
                </plugin>

Hope to release the 1.0.1 version soon!

@tdsproule
Copy link

For ick temporary workaround I copied single class io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest.java into my project that is compiled with "-parameters"

@kaqqao
Copy link
Member

kaqqao commented Jan 7, 2024

Released v1.0.1 to address this. Thanks everyone!

@kaqqao kaqqao closed this as completed Jan 7, 2024
@anandnd
Copy link

anandnd commented Aug 8, 2024

Same issue in Sprint boot 3.3.1 as well,

Just met the same issue in Spring Boot 3.2.0. From the thrown error, making the following changes resolved the issue (tested against the main branch, 1.0.1-SNAPSHOT):

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <parameters>true</parameters>
                        <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    </configuration>
                </plugin>

Hope to release the 1.0.1 version soon!

Same issue in Spring boot 3.3.1, suggested change is fixing it.

@anandnd
Copy link

anandnd commented Aug 8, 2024

Same issue in Sprint boot 3.3.1 as well,

Just met the same issue in Spring Boot 3.2.0. From the thrown error, making the following changes resolved the issue (tested against the main branch, 1.0.1-SNAPSHOT):

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <parameters>true</parameters>
                        <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    </configuration>
                </plugin>

Hope to release the 1.0.1 version soon!

Same issue in Spring boot 3.3.1, suggested change is fixing it.

So the actual fix is to have @ConstructorProperties annotation with GraphQLRequest (in this example), POM changes not required.

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

7 participants