caused by: java.lang.IllegalStateException: Method has too many Body parameters: 多参数问题

https://blog.csdn.net/liuchuanhong1/article/details/54728681

多参数问题

    1. @RequestMapping(value="/user/name", method=RequestMethod.GET)
    2.  

      User findByUsername(final String userName, final String address);

启动服务的时候,会报如下异常:

Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.chhliu.springboot.restful.vo.User com.chhliu.springboot.restful.feignclient.UserFeignClient.findByUsername(java.lang.String,java.lang.String)

异常原因:当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰。

上面问题的解决方案如下:

@RequestMapping(value="/user/name", method=RequestMethod.GET)
User findByUsername(@RequestParam("userName") final String userName, @RequestParam("address") final String address);

 

原文地址:https://www.cnblogs.com/wsnan/p/12069378.html

时间: 2024-08-11 14:10:13

caused by: java.lang.IllegalStateException: Method has too many Body parameters: 多参数问题的相关文章

【异常】Caused by: java.lang.IllegalStateException: Method has too many Body parameters

出现此异常原因是引文使用feign客户端的时候,参数没有用注解修饰 1.1GET方式错误写法 @RequestMapping(value="/test", method=RequestMethod.GET) Model test(final String name, final int age); 启动服务的时候,会报如下异常: Caused by: java.lang.IllegalStateException: Method has too many Body parameters

Caused by: java.lang.IllegalStateException: Ambiguous mapping found

Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map ‘myCockpitMgrController’ bean method 报错为:Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map ‘myCockpitMgrController’ bean method 是因为两个请求,请求到同

Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mchange.v2.c3p0.ComboPooledDataSource] from ClassLoader [ParallelWebappClassLoader

Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mchange.v2.c3p0.ComboPooledDataSource] from ClassLoader [ParallelWebappClassLoader 020-04-11 18:49:17,914 WARN [org.springframework.web.context.support.XmlWebApplicationConte

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError

SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.Exception in thread "main" java.lang.Exception

Caused by: java.lang.IllegalStateException: getOutputStream() has already been called for this respo

1.错误描述 Caused by: java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter(Response.java:648) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFa

Caused by: java.lang.IllegalStateException: The specified child already has a parent. You

ViewPager 报错:Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 一中是removeView这个问题很常见的,具体解决方法就不谈了,另外一种是情况如下: adapter=new ViewPagerAdapter(Views); views>>  view

Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 3939

在使用Gson解析JSON数据时,报错:Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 3939 原因:传入的参数有问题: while((len=inputStream.read(data))!=-1){ outPutStream.write(data,0,len); } 错写成: while((len=inputStream.read())!=-1

ssm项目——异常:Caused by: java.lang.IllegalStateException

异常:Caused by: java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found 大意:java.lang.String 与所需要的javax.sql.Data

Caused by: java.lang.IllegalStateException: duplicate key: datasource

java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yaml' at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:537) at org.springfram