codecentric / spring-boot-admin

Admin UI for administration of spring boot applications
Apache License 2.0
12.32k stars 3.07k forks source link

Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] and content type [text/html] #547

Closed haozishuizhaole closed 6 years ago

haozishuizhaole commented 7 years ago

Hello,My application Failed to register springbootadmin。logs: 2017-09-09 14:46:51.317 349132 [registrationTask1] WARN d.c.b.a.client.registration.ApplicationRegistrator - Failed to register application as Application [name=notify, managementUrl=http://domain/notify, healthUrl=http://domain/notify/health, serviceUrl=http://domain/notify/] at spring-boot-admin ([http://domain/springbootadmin/api/applications]): Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] and content type [text/html]

joshiste commented 7 years ago

Somehow the admin responses with content-type text/html. Do you have any proxies / servlet filters / security (or something else) in between that gives the wrong response? Did you investigate the response?

haozishuizhaole commented 7 years ago

Yeah! I don't hove any proxies, filters , security or something else. It's very simple.

anderius commented 7 years ago

@czhmzwlaoda: If you visit http://domain/springbootadmin/api/applications in your browser, you get the JSON list of applications back?

dotw commented 7 years ago

Guys, I have the same issue. it returns JSON list when I visit http://domain/springbootadmin/api/applications

dotw commented 7 years ago

I switched the log level to debug and found that boot admin request /actuator/health/ instead of /actuator/health. Why there is additional / here? then, I configured my application security to ignore the pattern /health/** then I can see the client register itself successfully. BUT, I can only see Detail & Trace tabs.

 : http-outgoing-0 >> GET /actuator/health/ HTTP/1.1
2017-09-13 13:45:21.889 DEBUG 2858 --- [    updateTask1] org.apache.http.headers                  : http-outgoing-0 >> Accept: application/json
haozishuizhaole commented 7 years ago

I use GET to visited http://domain/notify/health ,it return a json Object: { status: "UP", diskSpace: { status: "UP", total: 52707143680, free: 42495074304, threshold: 10485760 }, redis: { status: "UP", version: "3.2.8" } } But, This application was not registered

joshiste commented 7 years ago

@czhmzwlaoda the problem is not that the GET to http://domain/notify/health is responded with text/html but the POST to http://domain/springbootadmin/api/applications. So you've investigated the wrong url.

haozishuizhaole commented 7 years ago

@joshiste Yeah, but I try to POST or GET http://domain/springbootadmin/api/applications , it return an empty JSON Array

joshiste commented 7 years ago

Did you try from your client's machine?

haozishuizhaole commented 7 years ago

@joshiste They run on the same machine

joshiste commented 6 years ago

So maybe the best is that you tap the wire using tcpdum to look at the response your client applicaiton is getting.

joshiste commented 6 years ago

closed due to missing feedback

y-luis-rojo commented 6 years ago

Hi. I am having the same problem. A GET request to http://domain/springbootadmin/api/applications returns a JSON, including:

"statusInfo":{"status":"OFFLINE","timestamp":1514464505597,"details":{"exception":"org.springframework.web.client.RestClientException","message":"Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] and content type [application/octet-stream]"}},"source":"http-api"

The Content-Type of the response to a GET request to http://domain/someapp/health is application/vnd.spring-boot.actuator.v1+json;charset=UTF-8

nissshh commented 4 years ago

I get the same error as

2020-06-15 17:16:57,651 DEBUG de.codecentric.boot.admin.client.registration.ApplicationRegistrator [registrationTask1] Failed to register application as Application(name=jd-warranty-notification-services, managementUrl=http://hostname:8081/manage/api/notifications, healthUrl=http://hostname:8081/manage/api/notifications/health, serviceUrl=http://hostname:8081/) at spring-boot-admin ([https://hostname/manage/admin/instances]): Could not extract response: no suitable HttpMessageConverter found for response type [java.util.Map<java.lang.String, java.lang.Object>] and content type [text/html] <

I have SBA on AWS ALB (CLoudfront>ALB>EC2 (Tomcat). If I deploy on localhost SBA it works just fine, but on cloud it has issues.

nissshh commented 4 years ago

Update , I was able to resolve above bu specifying

spring.boot.admin.ui.public-url=https://XXXXX.com/manage/admin

server.servlet.context-path=/manage/admin

spring.boot.admin.context-path=/manage/admin server.forward-headers-strategy=native server.use-forward-headers = true and on client side

Boot configs

spring.boot.admin.client.url=http://xxxx/manage/admin spring.boot.admin.client.instance.service-base-url=https://xxxx/api/notifications spring.boot.admin.client.instance.management-base-url=https://warranty.tal.deere.com spring.boot.admin.client.auto-deregistration=true spring.boot.admin.routes.endpoints=env, metrics, trace, jolokia, info, configprops management.endpoints.web.exposure.include=* management.endpoints.web.base-path=/manage/api/notifications

daotq2000 commented 1 month ago

image In my case response return as HTML/TEXT that is message block request from cloudflare but expected response are: { "createdAt": "2024-07-23T09:03:05.039098Z", "updatedAt": "2024-07-26T02:31:22.895241Z", "createdBy": null, "updatedBy": "thuydp2@vingroup.net", "id": "d0f0ae7e-6733-4163-a2cb-cb98d77d1cc7", "serviceCode": "Parking", "vendor": "MT", "locationId": null, "agentId": "8226_Agent1", "eventId": "Parking_MT_8226_Agent1_8325685", "baixeId": null, "baixeName": null, "basementIdIn": "TK", "basementIdOut": "S1", "inLpn": "30F65662", "inTime": "2024-07-19T10:12:04.673Z", "inLpnImg": "23-07-2024/mt-bs-in-05.png", "inOvwImg": "23-07-2024/mt-ov-in-05.png", "machineIn": "OTS1.H1.01", "outLpn": "30F65662", "outTime": "2024-07-19T10:19:53.017Z", "outLpnImg": "23-07-2024/mt-bs-out-05.png", "outOvwImg": "23-07-2024/mt-ov-out-05.png", "machineOut": "OTS1.H1.01", "areaId": "19", "areaCode": "8220", "areaName": "Vinhomes Skylake", "bucketName": "8220.tgx02", "voucherType": "VF_EV", "cardId": null, "cardTypeId": null, "checkout": 1, "totalFee": "0", "discountFee": "0.0", "paidFee": "0.0", "postCheckStatus": "NULL", "postCheckTime": null, "postChecker": { "fullName": "Đinh Phương Thúy", "userCode": "3645222", "username": "thuydp2@vingroup.net" }, "postCheckDeadline": null, "isEmptyLicensePlate": null, "isSubscription": null, "violate": "Xe xăng VF vãng lai", "loss": 11111231, "note": "23123", "hadViolationReport": false }

So restTemplate can't parse response to object. However, the status is 200 and response is text/html. On going debugging we can't see error on catch block. I just aware that when call to target URI by postman. Please aware that.