XML Parsing Error: no element found Location: http://localhost:8081/web-app/pages/login.xhtml Line Number 1, Column 1: ^

前端 未结 2 2106
野的像风
野的像风 2021-01-19 14:54

My login.xhtml starts with:




        
2条回答
  •  旧时难觅i
    2021-01-19 15:39

    XML Parsing Error: no root element found

    The ERROR occurs when your client send a request like below:

    curl -X GET --header 'Accept: application/json' 'http://192.168.1.249:9001/students/
    

    you can see in header like 'Accept: application/json' this means the client only accept the server response in JSON format.

    But Server produces a response type in XML content type and it will try to parse the XML to JSON. During this phase exception triggers.

    SOLUTION :

    Please change the response content type to application/json or Change the request header to 'Accept: application/xml'.

    Thanks.

提交回复
热议问题