在使用 MyFaces 制作 Web 应用程序的某个时刻,我的 faces-config.xml 和 web.xml 开始发生冲突,但似乎在我做出任何更改之后很久。我一直在尝试不同的罐子和不同的配置,但无法正确安装任何东西。尽管我觉得我已经尝试了所有方法(解决方案除外),但这是代码的一个实例:
网页.xml:
<?xml version="1.0" encoding="UTF-8">
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
faces-config.xml 简介:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
我收到了这个错误:
SEVERE [org.apache.commons.digester.Digester] (MSC service thread 1-2) Parse Error at line 2 column 14:
Document is invalid: no grammar found.: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:390)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:136)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)
at org.apache.commons.digester.Digester.parse(Digester.java:1745) [commons-digester-1.8.jar:]
at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:197) [myfaces-impl-1.1.8.jar:]
并且:
SEVERE [org.apache.commons.digester.Digester] (MSC service thread 1-2) Parse Error at line 2 column 14:
Document root element "faces-config", must match DOCTYPE root "null".: org.xml.sax.SAXParseException: Document root element "faces-config", must match DOCTYPE root "null".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
我疯了为什么这不起作用。为什么很明显,我错过了它?还是这些文件不存在问题所以我应该尝试更改我的罐子?我正在使用 JBOSS 7 进行部署。谢谢!谢谢!