My login.xhtml
starts with:
XML Parsing Error: no element found Location: [...] Line Number 1, Column 1
To the point, this exact error means that the webbrowser retrieved an entirely empty response while it is being instructed to interpret the response as XML, usually via the Content-Type
header such as application/xhtml+xml
or application/xml
, or if absent, via the file extension in URL such as .xhtml
or .xml
.
Given that this happens while requesting a JSF login page, this strongly suggests that it contained a syntax/runtime error and that the webapp doesn't have error handling correctly configured. Apparently error pages themselves are also blocked behind a login/security constraint, causing the server being unable to present a "normal" error page with all exception detail and therefore return a completely empty response.
Your best bet is reading the server logs for the actual exception and/or running a debugger and/or creating a JSF exception handler which explicitly logs exceptions to server log (just in case you couldn't find exceptions and thus they appear to be swallowed). Once having the actual exception at hands, it's usually a matter of using the exception type + message + 1st line as keywords to find clues on the Internet.
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.