You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 31, 2024. It is now read-only.
@EnableEurekaClient
@EnableCircuitBreaker
@SpringBootApplication
@EnableTransactionManagement
@MapperScan("com.xxx.mapper")
@EnableSwagger2Doc
@EnableFeignClients
public class ClientApplication {
public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
@Configuration
static class ClientConfiguration {
@Bean
public Encoder feignEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
}
}
the real code invoke server api
@Autowired
private FileApi fileApi;
@Test
public void print() throws Exception {
Path path = Paths.get("src/test/resources/test.txt");
String name = "file";
String originalFileName = "src/test/resources/test.txt";
String contentType = "application/octet-stream";
byte[] content = Files.readAllBytes(path);
// 3.4.0 not works
//FormData formData = new FormData("application/octet-stream", "mockname.txt", content);
// 3.3.0 works here
FormData formData = new FormData("application/octet-stream", content);
fileApi.uploadFile(formData);
}
error message
Caused by: feign.FeignException: status 500 reading FileApi#uploadFile(FormData); content:
{"timestamp":"2018-10-26 11:38:40","status":500,"error":"Internal Server Error","message":"Type definition error: [simple type, class feign.form.FormData]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `feign.form.FormData` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (PushbackInputStream); line: 1, column: 2]","path":"/file/uploadformdata"}
at feign.FeignException.errorStatus(FeignException.java:62)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
... 27 more
code
error message
Thanks for any help!