java.lang.IllegalStateException:找不到工厂 javax.faces.application.ApplicationFactory 的备份 [英] java.lang.IllegalStateException:Could not find backup for factory javax.faces.application.ApplicationFactory
问题描述
我正在使用这个:
- Tomcat 7.0
- JSF 2.0
- JRE 7
但是在尝试运行我的应用程序时,出现以下异常:
but when trying to run my application, I got the following exception:
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 org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:159)
at org.apache.myfaces.context.servlet.FacesContextImplBase.getELContext(FacesContextImplBase.java:210)
at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:1463)
at org.apache.myfaces.webapp.AbstractFacesInitializer._createFacesContext(AbstractFacesInitializer.java:477)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initStartupFacesContext(AbstractFacesInitializer.java:449)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
有什么想法吗?
谢谢,
推荐答案
如果您的 web 应用程序的运行时类路径被多个 JSF 实现/版本污染,则可能会发生这种情况.堆栈跟踪中的 org.apache.myfaces
条目表明您正在使用 MyFaces.因此,这个问题表明您在 webapp 的运行时类路径中有另一个 JSF 实现,如 Mojarra,它与它发生冲突.它可以通过 jsf-api.jar
或 jsf-impl.jar
或 javax.faces.jar
识别.如果您将它们全部删除,那么此问题应该会消失.
That may happen if your webapp's runtime classpath is polluted with multiple JSF impls/versions. The org.apache.myfaces
entries in the stack trace tells that you're using MyFaces. This problem thus suggests that you've another JSF implementation like Mojarra in the webapp's runtime classpath which is conflicting with it. It's recognizable by jsf-api.jar
, or jsf-impl.jar
, or javax.faces.jar
. If you remove all of them, then this problem should disappear.
或者,如果您确实打算使用 Mojarra 而不是 MyFaces(您没有在问题的任何地方明确说明意图的 JSF impl/version,但您只是一般性地将 JSF 规范说明为JSF 2.0",所以也许你实际上不知道你在做什么),那么你应该从你的 web 应用程序中删除 myfaces-*.jar
文件.
Or, if you actually intented to use Mojarra instead of MyFaces (you did namely not explicitly state the intented JSF impl/version anywhere in your question, but you just generically stated the JSF spec as in "JSF 2.0", so perhaps you actually had no clue what you was all doing), then you should be removing myfaces-*.jar
files from your webapp.
这篇关于java.lang.IllegalStateException:找不到工厂 javax.faces.application.ApplicationFactory 的备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!