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

java.lang.IllegalArgumentException: name is required #211

Closed
sdcuike opened this issue Aug 28, 2019 · 4 comments
Closed

java.lang.IllegalArgumentException: name is required #211

sdcuike opened this issue Aug 28, 2019 · 4 comments

Comments

@sdcuike
Copy link

sdcuike commented Aug 28, 2019

execute AiNickNameClient#getNickNameTypeForAi(String) fail. Cause by: name is required.
java.lang.IllegalArgumentException: name is required.
u0009at feign.template.QueryTemplate.create(QueryTemplate.java:66)
u0009at feign.RequestTemplate.lambda$appendQuery$0(RequestTemplate.java:611)
u0009at java.util.HashMap.compute(HashMap.java:1197)
u0009at feign.RequestTemplate.appendQuery(RequestTemplate.java:609)
u0009at feign.RequestTemplate.query(RequestTemplate.java:573)
u0009at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
u0009at feign.RequestTemplate.extractQueryTemplates(RequestTemplate.java:909)
u0009at feign.RequestTemplate.uri(RequestTemplate.java:423)
u0009at feign.RequestTemplate.uri(RequestTemplate.java:390)
u0009at feign.RequestTemplate.resolve(RequestTemplate.java:196)
u0009at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.resolve(ReflectiveFeign.java:320)
u0009at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:224)
u0009at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74)
u0009at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:106)
u0009at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
u0009at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
u0009at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
u0009at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
u0009at rx.Observable.unsafeSubscribe(Observable.java:10327)
u0009at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
u0009at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
u0009at rx.Observable.unsafeSubscribe(Observable.java:10327)
u0009at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
u0009at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
u0009at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
u0009at rx.Observable.unsafeSubscribe(Observable.java:10327)
u0009at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
u0009at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
u0009at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
u0009at com.xxx.feign.enhance.RequestContextHystrixConcurrencyStrategy$RequestContextCallable.call(RequestContextHystrixConcurrencyStrategy.java:77)
u0009at org.springframework.cloud.sleuth.instrument.async.TraceCallable.call(TraceCallable.java:70)
u0009at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
u0009at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
u0009at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
u0009at java.util.concurrent.FutureTask.run(FutureTask.java:266)
u0009at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
u0009at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
u0009at java.lang.Thread.run(Thread.java:748)

but the code have name:

@PostMapping(path = "/xxx")
    String getNameT(@RequestParam("data") String data);
@sdcuike
Copy link
Author

sdcuike commented Aug 29, 2019

This happened by accident,in production environment

	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-openfeign</artifactId>
	<version>2.1.1.RELEASE</version>

@spencergibb
Copy link
Member

Please learn how to properly format code and logs.

Can you please show the full definition of the feign client?

@naavo
Copy link

naavo commented Sep 19, 2019

I would hate to step over something but we hit up a similar issue and thought would post it here. If its a different issue please let me know i could create an separate issue.

That being said we encountered this when a RequestParam had

&&

in them. Here is a test project that replicates this behavior.

  • Feign Client

  • Test that could be run that would show the above error.

  • Another thing observed but have not written a test for this yet is if the QueryParameter contains a single '&' character in between and because of this code in RequestTemplate - it causes the parameter to be split up am assuming the resolution to above would resolve this as well.

  • Also if we pass the parameter as SpringQueryMap it gets encoded correctly and the test passes. Here is a test

Please let me know if this is valid.

@OlgaMaciaszek
Copy link
Collaborator

Hi @naavo - yes this looks like a different issue. Please create a separate one. Closing this one.

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

No branches or pull requests

5 participants