如何使用 Omnifaces 1.14.1 修复 javax.xml.xpath.XPathFactoryConfigurationException
How to fix javax.xml.xpath.XPathFactoryConfigurationException with Omnifaces 1.14.1
我们有一个 JSF 2.0 Web 应用程序,运行 在 WAS 8.5 上,我们在其中使用 Omnifaces FullAjaxExceptionHandlerFactory。剩下的应用程序中没有使用 Omnifaces 的任何其他内容。 UI 基于 Primefaces 框架。
应用程序正常启动但在某些操作(应用程序中的更改选项卡,按按钮)时出现以下异常:
000000d2 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [FacesServlet] in application [<anonymized>]. Exception created : [java.lang.UnsupportedOperationException: java.lang.RuntimeException: javax.xml.xpath.XPathFactoryConfigurationException: Provider javax.xml.xpath.XPathFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: wsjar:file:/<anonymized>/lib/Saxon-HE-9.5.1-1.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
at org.omnifaces.config.WebXml.init(WebXml.java:186)
at org.omnifaces.config.WebXml.init(WebXml.java:162)
at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:388)
at org.omnifaces.config.WebXml.findErrorPageLocation(WebXml.java:208)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.findErrorPageLocation(FullAjaxExceptionHandler.java:418)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handleAjaxException(FullAjaxExceptionHandler.java:350)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handle(FullAjaxExceptionHandler.java:322)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1238)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1404)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:196)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3490)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4077)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: java.lang.RuntimeException: javax.xml.xpath.XPathFactoryConfigurationException: Provider javax.xml.xpath.XPathFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: wsjar:file:/<anonymized>/lib/Saxon-HE-9.5.1-1.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)
at org.omnifaces.config.WebXml.init(WebXml.java:175)
... 39 more
如果我注释掉 pom.xml 中的依赖项和 faces-config.xml 中的工厂。该应用程序运行良好。
这里是faces中的条目-config.xml
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
是否知道不兼容从何而来?
Is there any idea, from where the incompatibility comes from?
不兼容性来自您项目中的依赖项:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-1</version>
</dependency>
Saxon-HE-9.5.1-1.jar 包含一项服务 /META-INF/services/javax.xml.xpath.XPathFactory,其中包含非法包含空格的行:
net.sf.saxon.xpath.XPathFactoryImpl
http\://java.sun.com/jaxp/xpath/dom: net.sf.saxon.xpath.XPathFactoryImpl
http\://saxon.sf.net/jaxp/xpath/om: net.sf.saxon.xpath.XPathFactoryImpl
这在 javax.xml.xpath.ServiceLoader.parseLine
方法中失败:
....
if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
fail(service, u, lc, "Illegal configuration-file syntax");
....
尝试将您的 Saxon-HE 版本升级为 9.5.1-1 is rather old (2013) 并且似乎与 Java 8+ 不兼容。
版本 9.5.1-5 是 first version with this bug fixed。
The following bugs are cleared in 9.5.1.5, issued 2014-03-25
...
1944 Illegal configuration-file syntax in META-INF/services/javax.xml.xpath.XPathFactory
我们有一个 JSF 2.0 Web 应用程序,运行 在 WAS 8.5 上,我们在其中使用 Omnifaces FullAjaxExceptionHandlerFactory。剩下的应用程序中没有使用 Omnifaces 的任何其他内容。 UI 基于 Primefaces 框架。
应用程序正常启动但在某些操作(应用程序中的更改选项卡,按按钮)时出现以下异常:
000000d2 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [FacesServlet] in application [<anonymized>]. Exception created : [java.lang.UnsupportedOperationException: java.lang.RuntimeException: javax.xml.xpath.XPathFactoryConfigurationException: Provider javax.xml.xpath.XPathFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: wsjar:file:/<anonymized>/lib/Saxon-HE-9.5.1-1.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
at org.omnifaces.config.WebXml.init(WebXml.java:186)
at org.omnifaces.config.WebXml.init(WebXml.java:162)
at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:388)
at org.omnifaces.config.WebXml.findErrorPageLocation(WebXml.java:208)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.findErrorPageLocation(FullAjaxExceptionHandler.java:418)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handleAjaxException(FullAjaxExceptionHandler.java:350)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handle(FullAjaxExceptionHandler.java:322)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1238)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1404)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:196)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3490)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4077)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: java.lang.RuntimeException: javax.xml.xpath.XPathFactoryConfigurationException: Provider javax.xml.xpath.XPathFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: wsjar:file:/<anonymized>/lib/Saxon-HE-9.5.1-1.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)
at org.omnifaces.config.WebXml.init(WebXml.java:175)
... 39 more
如果我注释掉 pom.xml 中的依赖项和 faces-config.xml 中的工厂。该应用程序运行良好。
这里是faces中的条目-config.xml
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
是否知道不兼容从何而来?
Is there any idea, from where the incompatibility comes from?
不兼容性来自您项目中的依赖项:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-1</version>
</dependency>
Saxon-HE-9.5.1-1.jar 包含一项服务 /META-INF/services/javax.xml.xpath.XPathFactory,其中包含非法包含空格的行:
net.sf.saxon.xpath.XPathFactoryImpl
http\://java.sun.com/jaxp/xpath/dom: net.sf.saxon.xpath.XPathFactoryImpl
http\://saxon.sf.net/jaxp/xpath/om: net.sf.saxon.xpath.XPathFactoryImpl
这在 javax.xml.xpath.ServiceLoader.parseLine
方法中失败:
....
if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
fail(service, u, lc, "Illegal configuration-file syntax");
....
尝试将您的 Saxon-HE 版本升级为 9.5.1-1 is rather old (2013) 并且似乎与 Java 8+ 不兼容。
版本 9.5.1-5 是 first version with this bug fixed。
The following bugs are cleared in 9.5.1.5, issued 2014-03-25
...
1944 Illegal configuration-file syntax in META-INF/services/javax.xml.xpath.XPathFactory