本文介绍了找不到Factory:javax.faces.application.ApplicationFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我正在尝试一起使用以下技术:
Hi i am trying to use following technologies together:
- JSF 2.1.0
- ICEFaces 2.0.2 这是根据他们的文档,适用于 JSF 2.1.x
- Tomcat 6
- JSF 2.1.0
- ICEFaces 2.0.2 which is according to their documentation, works fine with JSF 2.1.x
- Tomcat 6
我的 web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>appName</display-name>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:META-INF/spring/applicationContext.xml
</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>/</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
但是在尝试运行我的应用程序时,我遇到以下异常:
but when trying to run my application, i got the following exception:
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:815)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:317)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:112)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:329)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4245)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4886)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4750)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
任何想法为什么?
推荐答案
JSF 2.1 容器。你有两个选择:
JSF 2.1 requires a Servlet 3.0 compatible container, yet Tomcat 6 is only a Servlet 2.5 compatible container. You've 2 options:
- 将JSF 2.1降级为JSF 2.0(Mojarra 2.0是已经在2.1.3)。这是必需的,因为Mojarra 2.1.0包含注释扫描程序中的错误,使其与Tomcat和Jetty不兼容。
If you choose option 2 (upgrading to Tomcat 7.0), then you should upgrade Mojarra 2.1.0 to at least Mojarra 2.1.1 (it's currently already at 2.1.3). This is required because Mojarra 2.1.0 contains a bug in the annotation scanner which makes it incompatible with Tomcat and Jetty.
- Mojarra 2.1.0 - FCS doesn't work with tomcat 7
这篇关于找不到Factory:javax.faces.application.ApplicationFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!