# No Factories configured for this Application - Myfaces mit Tomcat



## flobbie (13. Okt 2010)

Hi,
ich fange gerade mit JSF und Facelets an, leider bekomme ich mein erstes Projekt mit MyFaces nicht zum laufen.
Tomcat startet mit einer Fehlermeldung und ich erhalte immer ein 404 wenn ich eine Datei aufrufe.

Beim Starten von Tomcat erhalte ich folgenden Fehler ( es ist egal, ob ich Tomcat mit start, run oder die startup.sh ausführe ).
./bin/catalina.sh run

```
Oct 13, 2010 9:46:40 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Oct 13, 2010 9:46:40 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Oct 13, 2010 9:46:40 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@491c4c]) and a value of type [org.apache.myfaces.context.servlet.StartupFacesContextImpl] (value [org.apache.myfaces.context.servlet.StartupFacesContextImpl@1e0f2f6]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 13, 2010 9:46:40 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@16f25a7]) and a value of type [org.apache.myfaces.context.servlet.StartupFacesContextImpl] (value [org.apache.myfaces.context.servlet.StartupFacesContextImpl@110c31]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 13, 2010 9:46:40 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 13, 2010 9:46:40 AM org.apache.coyote.ajp.AjpProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Oct 13, 2010 9:46:40 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1027 ms
```

Im Logfile finde ich dann immer folgenden Eintrag:

```
Oct 12, 2010 10:12:06 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:172)
        at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131)
        at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:239)
        at org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:273)
        at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:153)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4362)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:4933)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:215)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:785)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:763)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:557)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1124)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1047)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:542)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1390)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:355)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:313)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:293)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:996)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
        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:415)
```

Was kann ich gegen den Fehler tun?

Ich wollte eigentlich mein Projekt hier hochladen, kann ich aber leider gar nicht.
Mein Projekt: http://flobbie.de/firstJSF.war
In meinem Projekt sollte es keine 404 geben, wenn man pages/enterInformation.jsf aufruft, dort gibt es aber dennoch eine 404 Meldung.

Ich nutze Tomcat 7.0.2 ( vorher 6.0.29 mit dem selben Fehler ) und JDK 1.6.0.21 sowie MyFaces 2.0.2.

Vielen Dank.
Freundliche Grüße
flobbie


----------



## ruutaiokwu (13. Okt 2010)

hallo,

evtl. besteht auch das vom mir vermutete problem: http://www.java-forum.org/web-tier/107085-jsf-laeuft-ausserhalb-servlet-containers.html


gruss, jan


----------

