java.lang.IllegalArgumentException: javax.faces.lifecycle.ClientWindowFactory [英] java.lang.IllegalArgumentException: javax.faces.lifecycle.ClientWindowFactory

查看:18
本文介绍了java.lang.IllegalArgumentException: javax.faces.lifecycle.ClientWindowFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在开发服务器上运行一个 web 应用程序,最近有人为我们构建了一个生产服务器(据称)完全相同的 tomcat 配置,包括/lib 目录中的 JSF 库.当我尝试部署我的应用程序时,新服务器抛出了一个相当混乱的错误消息,我希望得到一些帮助理解.

We've been running a web app on a development server and recently somebody built a production server for us (with supposedly) the exact same tomcat config including the JSF libraries in the /lib directory. When I try to deploy my app the new server is throwing a rather confusing error message that I'd love some help understanding.

生产和开发日志在这一点上看起来相似:

Both Production and Devel logs look similar up to this point:

24-Jun-2015 13:16:47.880 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/fleetforecaster/ff-tomcat/webapps/ROOT.war
24-Jun-2015 13:16:47.903 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
24-Jun-2015 13:16:47.911 WARNING [localhost-startStop-1] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Context/Realm} Setting property 'debug' to '99' did not find a matching property.
24-Jun-2015 13:16:52.059 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
24-Jun-2015 13:16:52.180 INFO [localhost-startStop-1] null.null Initializing Mojarra 2.2.5 ( 20140108-1427 https://svn.java.net/svn/mojarra~svn/tags/2.2.5@12761) for context ''
24-Jun-2015 13:16:52.401 INFO [localhost-startStop-1] null.null JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
24-Jun-2015 13:16:52.429 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 18 at position 20
24-Jun-2015 13:16:52.430 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 0 at position 21
24-Jun-2015 13:16:52.431 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 0 at position 22
24-Jun-2015 13:16:52.435 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 18 at position 63
24-Jun-2015 13:16:52.436 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 0 at position 64
24-Jun-2015 13:16:52.437 SEVERE [localhost-startStop-1] null.null Unknow type constant pool 0 at position 65

此时 prod 服务器开始抛出错误:

At which point the prod server starts throwing errors:

24-Jun-2015 13:16:52.606 SEVERE [localhost-startStop-1] null.null Critical error during deployment:
 com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! javax.faces.lifecycle.ClientWindowFactory
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
    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.deployWAR(HostConfig.java:945)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: javax.faces.lifecycle.ClientWindowFactory
    at javax.faces.FactoryFinder.validateFactoryName(FactoryFinder.java:674)
    at javax.faces.FactoryFinder.setFactory(FactoryFinder.java:368)
    at com.sun.faces.config.processor.FactoryConfigProcessor.setFactory(FactoryConfigProcessor.java:317)
    at com.sun.faces.config.processor.FactoryConfigProcessor.processFactories(FactoryConfigProcessor.java:274)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:216)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
    ... 14 more

接着是第二个错误块:

24-Jun-2015 13:16:52.609 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
24-Jun-2015 13:16:52.621 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
24-Jun-2015 13:16:52.628 SEVERE [localhost-startStop-1] null.null Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.
24-Jun-2015 13:16:52.628 SEVERE [localhost-startStop-1] null.null 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:1011)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
    at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:310)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4774)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390)
    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.deployWAR(HostConfig.java:945)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

两台服务器(据我所知)配置相同 - 它们在/lib 目录中有 2 个额外的库用于 JSF 和 JSTL.

Both servers (as far as I can tell) are configured the same - they have 2 additional libs in the /lib directory for JSF and JSTL.

知道这些错误消息是什么意思吗?我必须假设它与 tomcat 安装有关,因为完全相同的战争在一台服务器上运行良好,但在另一台服务器上运行良好.

Any idea what these error messages mean? I must assume its something related to the tomcat install as the exact same war runs fine on one sever but not the other.

还有一句话说:

    24-Jun-2015 13:16:52.609 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file

我到底在哪里找到适当的容器日志文件"

Where exactly do i find the "appropriate container log file"

jsf-api-2.1.7.jar jsf-impl-2.1.7.jar

atmosphere-runtime-2.3.0.jar
commons-codec-1.5.jar
commons-fileupload-1.3.1.jar
commons-io-2.2.jar
commons-lang-2.6.jar
commons-logging-1.2.jar
dom4j-1.6.1.jar
javaee-web-api-7.0.jar
javax.faces-2.2.5.jar
javax.inject-1.jar
javax.servlet-api-3.0.1.jar
joda-time-2.3.jar
jsf-api-2.1.13.jar
jsf-impl-2.1.13.jar
jstl-1.2.jar
mysql-connector-java-5.1.30.jar
poi-3.10-FINAL.jar
poi-ooxml-3.9.jar
poi-ooxml-schemas-3.9.jar
primefaces-5.1.jar
slf4j-api-1.7.7.jar
stax-api-1.0.1.jar
trove4j-3.0.3.jar
xml-apis-1.0.b2.jar
xmlbeans-2.3.0.jar

推荐答案

webapp 的运行时类路径一团糟.

The webapp's runtime classpath is a mess.

去掉/WEB-INF/lib 中的那些 JAR

Get rid of those JARs in /WEB-INF/lib

  • javaee-web-api-7.0.jar
  • javax.faces-2.2.5.jar
  • javax.servlet-api-3.0.1.jar

第一个旨在用于编译面向 Java EE 7 容器的 WAR/EAR.它不打算与针对准系统 JSP/Servlet 容器(如 Tomcat)的 WAR 一起安装.它会感到困惑并认为它实际上是一个 Java EE 7 容器(哦,太高兴了).

The first one is intented to be used to compile a WAR/EAR targeting a Java EE 7 container. It isn't intented to be installed along a WAR targeting a barebones JSP/Servlet container like Tomcat. It would get confused and think that it's actually a Java EE 7 container (oh joy).

第二个是 Mojarra 2.2.5(API 和 impl 捆绑在单 JAR 风格中)以及您所看到的最初问题的原因.您基本上是针对先前已通过 Tomcat 的 /lib 加载的 JSF 2.1 API 加载 JSF 2.2 实现.javax.faces.lifecycle.ClientWindowFactory 自 JSF 2.2 以来是新的(另请参见 javadoc) 并且不被 JSF 2.1 API 识别.

The second one is Mojarra 2.2.5 (API and impl bundled in single-JAR flavor) and the cause of the initial trouble you're seeing. You're basically loading a JSF 2.2 implementation against a JSF 2.1 API already earlier loaded via Tomcat's /lib. The javax.faces.lifecycle.ClientWindowFactory is new since JSF 2.2 (see also @since in javadoc) and not recognized by JSF 2.1 API.

第三个应该是Tomcat自己提供的.请注意,Java EE 7 JAR 还包含 JSF 2.2 和 Servlet 3.1 API.所以这实际上是 JSF 和 Servlet API 的三重冲突(一个来自 Tomcat 的 /lib 的 API,一个来自 WAR 的 /WEB-INF/lib 的 API,以及一个来自Java EE 7 JAR 包;这不好).

The third one is supposed to be already provided by Tomcat itself. Note that Java EE 7 JAR also contains JSF 2.2 and Servlet 3.1 APIs. So that's after all actually a triple conflict for JSF and Servlet APIs (one API from Tomcat's /lib, one API from WAR's /WEB-INF/lib, and one API from Java EE 7 JAR bundle; that's not good).

无论如何,我建议您也清理 Tomcat 的/lib 并将其保留为默认值.只需坚持使用 WAR 的/WEB-INF/lib 中的 JAR.而且,如果您实际上打算构建一个针对 JSF 2.2 的 Web 应用程序(首先在 faces-config.xml 中仔细检查 version 如果匹配),然后保留在 javax.faces-2.2.5.jar 中并去掉那些 jsf-api-2.1.13.jarjsf-impl-2.1.13.jar 文件.

Regardless, I recommend to clean up Tomcat's /lib as well and keep it as default. Just stick to JARs in WAR's /WEB-INF/lib. And, if you actually intend to build a JSF 2.2 targeted web application (first doublecheck version in faces-config.xml if it matches), then keep in the javax.faces-2.2.5.jar and get rid of those jsf-api-2.1.13.jar and jsf-impl-2.1.13.jar files.

这篇关于java.lang.IllegalArgumentException: javax.faces.lifecycle.ClientWindowFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆