Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IllegalStateException:Could not find backup for factory javax.faces.application.ApplicationFactory

I'm using this :

  • 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) 

Any ideas why?

Thanks,

like image 984
Benjamin Gimet Avatar asked Sep 19 '13 14:09

Benjamin Gimet


1 Answers

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.

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.

See also:

  • JSF wiki page - Installing JSF
  • How to properly install and configure JSF libraries via Maven?
  • Difference between Mojarra and MyFaces
  • JSF implementations and component libraries
like image 183
BalusC Avatar answered Sep 20 '22 09:09

BalusC