jsf – java. Lang.illegalstateexception: cannot find factory javax faces. context. Backup of facescontextfactory

I created my Hello World JSF project, but when I deployed to Tomcat 7, I got this exception:

java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:350)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I have added these jars to my project:

> jstl-1.2. jar > javax. faces-api-2.2. jar

How did this happen and how should I solve it?

Solution

The exception basically tells it that the JSF implementation cannot be found

javax. faces-api-2.2. Jar is wrong There are two questions:

>This is a "blueprint" API jar intended for JSF implementers such as mojarra and myfaces. > You forgot to implement jar with JSF

If you want to use mojarra, you can install mojarra according to the instructions on the download page. There are two ways to install mojarra:

>A jar: javax faces-2. x. X.jar > or two jars: jsf-api-2 x. X.jar and jsf-impl-2 x. X.jar, where the version number must match exactly

Get rid of that javax faces-api-2.2. Jar and put the correct jar in / Web - inf / lib, the exception should disappear So far, mojarra 2.2 8 is the latest version. One jar is cleaner than two loose jars, so download javax-faces-2.2 8. Jar to replace the wrong jar

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>