XML解析错误:找不到元素位置:http://localhost:8081/web-app/pages/login.xhtml行号1,列1:^ [英] XML Parsing Error: no element found Location: http://localhost:8081/web-app/pages/login.xhtml Line Number 1, Column 1: ^

查看:1253
本文介绍了XML解析错误:找不到元素位置:http://localhost:8081/web-app/pages/login.xhtml行号1,列1:^的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的login.xhtml开头为:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

我正在使用Java 8,JSF,Primefaces,Maven,Tomcat8. 我认为我的配置有问题,例如servlet和web.xml.

I am using Java 8, JSF, Primefaces, Maven, Tomcat8. I think that something is wrong with my configuration e.g. servlets and web.xml.

推荐答案

XML解析错误:找不到元素位置:[...]行号1,列1

XML Parsing Error: no element found Location: [...] Line Number 1, Column 1

至此,确切的错误意味着通常在通过Content-Type标头(例如application/xhtml+xmlapplication/xml)时,网络浏览器在被指示将响应解释为XML时检索了一个完全为空的响应,或者缺少,通过URL的文件扩展名(例如.xhtml.xml).

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.

鉴于这种情况是在请求JSF登录页面时发生的,这强烈表明它包含语法/运行时错误,并且webapp没有正确配置错误处理.显然,错误页面本身也被阻止在登录/安全约束之下,从而导致服务器无法显示带有所有异常详细信息的正常"错误页面,因此返回的响应完全为空.

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解析错误:找不到元素位置:http://localhost:8081/web-app/pages/login.xhtml行号1,列1:^的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆