调试facelets-1.1.14的异常解决
部署Hangman例子,其WEB-INF/lib下包含如下JAR包:
· servlet-api-2.4.jar
· jsf-facelets.jar
· jsf-api-1.2_04-p02.jar
· el-impl-1.0.jar
· el-api-1.0.jar
· custom_jsf_lib_1_0_2.jar
但出现以下错误:
-
严重: Servlet /hangman threw load() exception
-
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
-
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
-
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:142)
-
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
-
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
-
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
-
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
-
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1173)
-
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1271)
-
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
-
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
-
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
-
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
-
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
-
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
-
at java.lang.Thread.run(Thread.java:619)
原因是缺少JAR包。继续添加JAR包:
· commons-beanutils.jar
· commons-collections.jar
· commons-digester.jar
· commons-logging.jar
· jsf-impl.jar
又出现以下错误:
-
严重: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
-
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
-
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:1570)
-
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:403)
-
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
-
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
-
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
-
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
-
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
-
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
-
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
-
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
-
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
-
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
-
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
-
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
-
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
-
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
-
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
-
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
-
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
-
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
-
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
-
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
-
at java.lang.reflect.Method.invoke(Method.java:597)
-
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
-
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
分析原因,是el-api-1.0.jar包与现有JAR包存在冲突,删之。最终库文件如下:
· servlet-api-2.4.jar
· jsf-facelets.jar
· jsf-api-1.2_04-p02.jar
· el-impl-1.0.jar
· custom_jsf_lib_1_0_2.jar
· commons-beanutils.jar
· commons-collections.jar
· commons-digester.jar
· commons-logging.jar
· jsf-impl.jar
搞定。亲切的页面出现,如下所示:
阅读(2234) | 评论(0) | 转发(0) |