gpt4 book ai didi

jsf-2 - org.xml.sax.SAXException : Error Handling [jar:file:{app}/WEB-INF/lib/jsf-impl-2. 2.9.jar!/META-INF/mojarra_ext.taglib.xml@47,31]

转载 作者:行者123 更新时间:2023-12-02 09:34:42 32 4
gpt4 key购买 nike

当我们部署到 tomcat 中时,我们的 JSF 应用程序工作正常,但是,当我们访问 UI 中的第一页时,我们收到此错误。之后在其他页面就看不到这个错误了。

这些是我们正在使用的 jsf 依赖项:

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.9</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.9</version>
<type>jar</type>
</dependency>

这是错误堆栈跟踪:

SEVERE: Error Loading Library: jar:file:../.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/{app}/WEB-INF/lib/jsf-impl-2.2.9.jar!/META-INF/mojarra_ext.taglib.xml
java.io.IOException: Error parsing [jar:file:../.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/{app}/WEB-INF/lib/jsf-impl-2.2.9.jar!/META-INF/mojarra_ext.taglib.xml]:
at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:410)
at com.sun.facelets.compiler.TagLibraryConfig.loadImplicit(TagLibraryConfig.java:431)
at com.sun.facelets.compiler.Compiler.initialize(Compiler.java:87)
at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:517)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
at javax.faces.webapp.FacesServlet.service(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.bphx.cool.jsf.CustomHeaderFilter.doFilter(CustomHeaderFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:611)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.xml.sax.SAXException: Error Handling [jar:file:../.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/{app}/WEB-INF/lib/jsf-impl-2.2.9.jar!/META-INF/mojarra_ext.taglib.xml@47,31]
at com.sun.facelets.compiler.TagLibraryConfig$LibraryHandler.error(TagLibraryConfig.java:376)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1599)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1877)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:742)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1370)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1290)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3130)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:880)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:407)
... 31 more

我该怎么做才能避免出现此错误日志?

最佳答案

恕我直言,我认为所选择的答案实际上并不能解决这个问题。至少它没有为我解决问题。

引发此异常的类 (com.sun.facelets.compiler.TagLibraryConfig$LibraryHandler) 来自独立的 Facelet 实现。如果调试此问题,您会发现此错误的根本原因是 XML 的根元素与 DTD 不匹配(提示:XMLDTDValidator.rootElementSpecified)。

鉴于 TagLibraryConfig 仅存在于独立的 Facelets 中,您可能遇到了与我相同的问题。发生的事情是,当旧的 Facelet 的 TagLibraryConfig 扫描类路径以查找 META-INF/**/*.taglib.xml 下的所有 facelet 标记库时,它会选择 Mojarra 的 META-INF/mojarra_ext.taglib .xml 与旧 DTD 不完全兼容(例如版本属性当时不存在)。它记录失败并愉快地继续。

避免此错误的最佳方法是开始使用 JSF 2.x 中内置的 Facelets。

但是,如果您坚持使用 Facelets 1.x(例如,因为您使用的是 RichFaces 3.x)并且对忽略此异常的含义感到好奇,您应该知道该标记库所做的只是提供了三个 Mojarra -特定标签:

  • regexValidator 复制自 JSF 2.0 以来可用的 f:validateRegex
  • creditcardValidator 执行基本的信用卡号格式验证和 Luhn 检查
  • focus 呈现一个将焦点设置在任意元素上的小脚本。

如果您不需要这些标签,忽略此错误是非常安全的。我考虑了几种将其从日志中删除的方法,但每种解决方案(关闭记录器、自定义上下文类加载器或自定义 FaceletViewHandler)要么有缺点,要么对于这样一个不重要的问题来说似乎有点矫枉过正。

关于jsf-2 - org.xml.sax.SAXException : Error Handling [jar:file:{app}/WEB-INF/lib/jsf-impl-2. 2.9.jar!/META-INF/mojarra_ext.taglib.xml@47,31],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28350362/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com