无法在JSF应用程序中解析文档faces-config.xml

时间:2016-02-28 21:13:32

标签: jsf tomcat jsf-2

我正在开发一个JSF Web应用程序。我将JSF 2.2与Apache Tomcat 8.0.27.0一起使用。 当我按下清洁&构建它工作正常,但当我尝试运行我的应用程序时,我得到了这个例外:

     com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: com.sun.faces.config.ConfigurationException: Unable to parse document 'file:/C:/Users/axeli/Desktop/SeminarioPagina/build/web/WEB-INF/faces-config.xml': null

    28-Feb-2016 18:00:19.275 INFO [http-nio-8084-exec-10] org.apache.catalina.util.LifecycleBase.stop The stop() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] after stop() had already been called. The second call will be ignored.
    28-Feb-2016 18:00:19.777 INFO [http-nio-8084-exec-10] org.apache.catalina.startup.HostConfig.undeploy Repliegue (undeploy) de la aplicación web que tiene como trayectoria de contexto 
    28-Feb-2016 18:00:19.878 INFO [http-nio-8084-exec-10] org.apache.catalina.startup.HostConfig.deployDescriptor Desplieque del descriptor de configuración C:\Users\axeli\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\ROOT.xml
    28-Feb-2016 18:00:19.878 WARNING [http-nio-8084-exec-10] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
    28-Feb-2016 18:00:20.826 INFO [http-nio-8084-exec-10] org.apache.jasper.servlet.TldScanner.scanJars Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP .
    28-Feb-2016 18:00:20.948 INFO [http-nio-8084-exec-10] com.sun.faces.config.ConfigureListener.contextInitialized Inicializando Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) para el contexto ''
    28-Feb-2016 18:00:21.079 SEVERE [http-nio-8084-exec-10] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment: 
     com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: com.sun.faces.config.ConfigurationException: Unable to parse document 'file:/C:/Users/axeli/Desktop/SeminarioPagina/build/web/WEB-INF/faces-config.xml': null
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:761)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:349)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:221)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4736)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:460)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1586)
        at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:906)
        at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:344)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.util.concurrent.ExecutionException: com.sun.faces.config.ConfigurationException: Unable to parse document 'file:/C:/Users/axeli/Desktop/SeminarioPagina/build/web/WEB-INF/faces-config.xml': null
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:759)
        ... 49 more
    Caused by: com.sun.faces.config.ConfigurationException: Unable to parse document 'file:/C:/Users/axeli/Desktop/SeminarioPagina/build/web/WEB-INF/faces-config.xml': null
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:1012)
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:954)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:747)
        ... 49 more
    Caused by: java.lang.NullPointerException
        at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:1172)
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:1003)
        ... 52 more

    28-Feb-2016 18:00:21.195 SEVERE [http-nio-8084-exec-10] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
    28-Feb-2016 18:00:21.195 SEVERE [http-nio-8084-exec-10] org.apache.catalina.core.StandardContext.startInternal Falló en arranque del Contexto [] debido a errores previos
    28-Feb-2016 18:00:21.227 SEVERE [http-nio-8084-exec-10] javax.faces.FactoryFinder$FactoryManager.copyInjectionProviderFromFacesContext Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
    28-Feb-2016 18:00:21.227 SEVERE [http-nio-8084-exec-10] javax.faces.FactoryFinder$FactoryManager.getFactory La aplicación no se ha inicializado correctamente durante el inicio, no se encuentra la fábrica: javax.faces.application.ApplicationFactory. Attempting to find backup.
    28-Feb-2016 18:00:21.227 SEVERE [http-nio-8084-exec-10] com.sun.faces.config.ConfigureListener.contextDestroyed Unexpected exception when attempting to tear down the Mojarra runtime
     java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. 
        at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
        at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:319)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4783)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5404)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:460)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1586)
        at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:906)
        at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:344)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

    28-Feb-2016 18:00:21.358 SEVERE [http-nio-8084-exec-10] javax.faces.FactoryFinder.releaseFactories Unable to call @PreDestroy annotated methods because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI?
    28-Feb-2016 18:00:21.390 INFO [http-nio-8084-exec-10] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\axeli\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\ROOT.xml has finished in 1.512 ms

这些是我现在正在使用的库:

enter image description here

2 个答案:

答案 0 :(得分:4)

  

com.sun.faces.config.ConfigManager中的java.lang.NullPointerException $ ParseTask.getDocument(ConfigManager.java:1172)

这通常只发生在faces-config.xml本身存在XML语法错误并且XML解析器(错误地)没有抛出异常但只返回null时。请仔细注意文档的XML格式。即每个<element>必须有匹配的</element>,并且每个"都必须匹配"等。

如果您正在使用IDE,请确保它具有必要的JSF / Java EE插件,这些插件通常负责XML验证。或者如果您已经拥有,请注意IDE中的错误/警告。如果您不确定,请在某些online XML validation tool中复制faces-config.xml,例如http://www.xmlvalidation.com

答案 1 :(得分:0)

由于某些原因,如果faces-config的version属性(可能还有名称空间defs)过高而应用程序服务器无法处理,也会发生这种情况。

我以某种方式在试图使用JSF 2.2的古老Glassfish 3上发现了这一点,而它只对2.0或2.1满意。

希望这可以帮助某人减少时间。

对于决定返回null作为有用信息的人:...实际上,我没什么好说的。


我知道应该可以升级Glassfish 3的库以支持JSF 2.2,但是并没有这样做。