Jsf 2 Omnifaces 1.8.1 WebXML解析异常

Jsf 2 Omnifaces 1.8.1 WebXML解析异常,jsf-2,omnifaces,Jsf 2,Omnifaces,尝试调用从org.w3c.dom.Node.getTextContent()返回的对象的方法java.lang.String.trim()时,我得到了一个java.lang.NullPointerException: 当我使用 List<String> welcomeFiles = WebXml.INSTANCE.getWelcomeFiles(); 在调试器中,welcomeFileList.item(i)的计算结果为index.jsp,但是调用welcomeFileList.

尝试调用从
org.w3c.dom.Node.getTextContent()返回的对象的方法
java.lang.String.trim()
时,我得到了一个
java.lang.NullPointerException:

当我使用

List<String> welcomeFiles = WebXml.INSTANCE.getWelcomeFiles(); 
在调试器中,
welcomeFileList.item(i)
的计算结果为
index.jsp
,但是调用
welcomeFileList.item(i).getTextContent()
会导致空值。我想不出来。。。我错过了什么

在日志中:

Jan 11, 2015 1:36:37 PM org.omnifaces.config.WebXml init
SEVERE: WebXml failed to initialize. Perhaps your web.xml contains a typo?
java.lang.NullPointerException: while trying to invoke the method java.lang.String.trim() of an object returned from org.w3c.dom.Node.getTextContent()
at org.omnifaces.config.WebXml.parseWelcomeFiles(WebXml.java:418
SAPNetweaver 7.4服务器上的Oracle JSF 2.1.26、Omnifaces 1.8.1、servlet 2.5、sapjvm6.1(Java6)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>tablemaint-web</display-name>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    ....
</webapp>

表格维护网站
index.jsp
....

这是所用JAXP解析器中的一个错误。这应该能正常工作。sapjaxp解析器显然无法将文本节点识别为文本节点。即在例如文档节点和文档类型节点上返回
null


使用
getFirstChild().getNodeValue()
而不是
getTextContent()
的解决方法似乎工作得很好(并且应该在像样的JAXP解析器上继续正常工作),因此这一点已经得到了解决,并且在今天的(以及2.x用户)中可以使用该修复方法。

。我怀疑正在使用的JAXP解析器中有一个bug。环境中正在使用哪个JAXP解析器?你能用
getFirstChild().getNodeValue()代替
getTextContent()
,在本地试用吗?我可以确认getFirstChild().getNodeValue()确实有效。JAXP提供程序来自SAP com.SAP.engine.lib.JAXP.saxparserfactoryImpl我现在注意到WebXML类是由omnifaces-config.xml(我认为是通过OmniPartialViewContext配置)自动初始化的,所以即使没有上面的特定代码,我也会得到这个NullPointerException。正如您所料,在这个平台上,其他getTextContent()方法也会抛出相同的错误。我不太希望SAP能修复这个bug,有没有可能找到omnifaces解决方案?我可以用
getFirstChild().getNodeValue()替换
getTextContent()
。毕竟,它只是获取文本节点的节点值的简写。
Jan 11, 2015 1:36:37 PM org.omnifaces.config.WebXml init
SEVERE: WebXml failed to initialize. Perhaps your web.xml contains a typo?
java.lang.NullPointerException: while trying to invoke the method java.lang.String.trim() of an object returned from org.w3c.dom.Node.getTextContent()
at org.omnifaces.config.WebXml.parseWelcomeFiles(WebXml.java:418
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>tablemaint-web</display-name>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    ....
</webapp>