我在我的应用程序中使用Spring,并且我试图使用Proguard混淆/优化/收缩。我在运行时得到了以下异常:
原因: org.springframework.web.client.RestClientException:无法编写请求:没有为请求类型找到合适的HttpMessageConverter,在org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:449) at org.springframework.web.client.RestTemplate.execute(RestTemplate.ja
Spring rest模板向我抛出了以下异常
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class [Lcom.flightsms.core.dto.AirlineResponseDTO;] and content type [text/html;charset=UTF-8]
下面是我的json响应
[
{
"airlineId": "
当我通过Rest Api发送请求时,结果是
内容-类型: application/json
{
"error": "file content is not in the appropriate format",
"file_name": "15-10-2019-11-19-32_KKK.csv"
}
当我在我这边尝试代码时,我使用下面的代码
public RestTemplate restTemplateBuilder() {
RestTemplate restTemplate = new RestTemplate(ne
我需要通过内容类型为MultiValueMap的RestTemplate发布一个对象(例如,不是application/x-www-form-urlencoded )。当我试图这么做的时候..。
HttpHeaders headers = new HttpHeaders();
HttpEntity request;
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED)
// data is some generic type
request = new HttpEntity<>(data, headers);
当我试图从我的web服务中获取对象时,我会得到以下异常:
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"html"). Expected elements are <{}user>
用户类使用@XmlRootElement注释,通过浏览器访问web服务,显示用户的xml表示形式。
客户端代码(我使用MediaType.TEXT_HTML是因为MediaType.APPLICATION_XML导致了RestClientException):
RestTemp
我一直在我的项目中获得以下异常:
HTTP request execution failed for URI [http://localhost:9502/clients/clientId] in the [bean 'retrieveClientIdConfigurationFlow.http:outbound-gateway#0' for component 'retrieveClientIdConfigurationFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#2
我使用模板从外部API中提取一些数据。这些API返回JSON字符串,但是响应内容类型是"text/html",如果内容类型是"application/json“,我可以轻松地解析数据,而不存在任何问题,因为这个API是第三方API,所以不能更改响应的内容类型。
我使用"MappingJacksonHttpMessageConverter“类作为消息转换器。
当我试图解析数据时,我会遇到异常。
org.springframework.web.client.RestClientException: Could not extract response: no sui
我试图更新密钥披风上的用户电子邮件,它会抛出这个异常
org.springframework.web.client.HttpServerErrorException$InternalServerError: 500内部服务器错误:没有人在org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultRe
我正在尝试解析spring boot中的以下xml响应:
响应结构:
<!DOCTYPE RESULT SYSTEM 'http://www.example.com/example/exampleV1.00.dtd'>
<RESULT REQID ='10961549902'>
<MID SUBMITDATE='2017-08-14 17:17:29' ID='1' TAG = 'null' TID = '24180566483'></MID>
我正在尝试解决我的RestTemplate PUT请求的问题。基本上,服务器希望数据(对象)放在"Raw“content类型中,但作为xml流。我尝试了许多组合(转换器、内容类型等)。但是什么都没有用。我要么以" org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter found for request type com.test.myObject"的身份得到异常
或者:
"The server en
我已经使用spring-boot-starter-data-rest创建了一个支持Hateoas的Rest服务,运行良好。
然后,我在另一个spring引导模块中创建了该rest服务的客户机:这是一个可以包含在其他希望使用rest服务的项目中的依赖项。它在引擎盖下使用restTemplate。它花了一点时间在HttpMessageConverters和TypeConstrainedMappingJackson2HttpMessageConverter上,让它工作,但它做到了。
我尝试在我的主应用程序中使用此依赖项,但它无法填充ResponseEntity< Resource< My
我想把邮件请求发送到服务器。我必须将JSON对象作为参数传递,并以JSON作为响应,但我得到了以下错误:
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.package.Response] and content type [application/octet-stream]
代码
发送请求:
@RestService
RestClient re
我使用Maven + Spring,我希望使用RestTemplate().postForEntity(url, request, responseType) + Content-Type=application/json,但是我有以下错误:
org.springframework.web.client.RestClientException:无法写入请求:没有为请求类型com.kizeoforms.model.User和内容类型application/json找到合适的HttpMessageConverter
java客户端代码:
User user = new User();
user.s
我正在查询一个json应用程序接口来获得翻译,并将头文件的内容类型设置为PhraseApp /json:
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
但是API会以附件的形式发送内容类型为text/json; charset=UTF-8的响应。而Spring则会引发错误:
org.springframework.web.client.RestClientException: Could not extrac
我试图使用RestTemplate发送一个POST请求到REST服务,但是出错了
RestClientException:无法编写请求:没有为请求类型xxx.query.XBrainQueryRequest和内容类型application/json找到合适的HttpMessageConverter。
XBrainQueryRequest request = new XBrainQueryRequest();
// set query ID
request.setQueryId(XBrainTradequeryId);
request.setFlags(new String[]{"
我只是尝试将我的spring-boot-web应用程序(一个REST webservice)升级到spring-版本。我使用弹簧启动执行器作为/health端点.使用我以前的spring版本(1.2.6.RELEASE),该端点能够使用媒体类型application/xml**,服务请求,但现在它已经中断了**。
请注意,我正在使用XStream作为XML序列化程序,通过为spring提供一个扩展WebMvcConfigurerAdapter以配置HTTP消息封送器的配置来配置它:
@Configuration
public class XStreamMarshallerConfigura
我有一个SpringBoot应用。使用此配置文件: @Configuration
public class ApplicationConfig {
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConve
当调用RestTemplate方法时,我会得到这个错误
GetStatusRestfulResponse response = restTemplate.getForObject(restRequest.getUrl(), GetStatusRestfulResponse.class,restRequest.getParams());
>org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for res
我使用下面这行代码来获取一个使用Spring RestTemplate的响应对象:
final ResponseEntity<Object> genericErrorResponse = restTemplate
.postForEntity("urlvalue.com", request,
Object.class);
我的目标是检查
if the response is 200: cast to Custom200ResponseModel
If response is 500: cast