user1557283
user1557283

Reputation: 1

No Factories configured for this Application

I am trying to run a JSF 2.0 webapp using Apache MyFaces 2.1.8 on a Tomcat 7 webserver.When i try to load a simple page i get this error:

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>

what should I do to fix it? Thanx!

Edit:

Pom.xml

<dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.3</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>2.1</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-impl</artifactId>
        <version>2.1.8</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-api</artifactId>
        <version>2.1.8</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-bundle</artifactId>
        <version>2.1.8</version>
    </dependency>

Upvotes: 0

Views: 9422

Answers (1)

MarkWinton
MarkWinton

Reputation: 11

I hit the same error message, using what I knew to be a good JSF portlet project set up (i.e. the values in the web.xml, faces-config.xml and in my case portlet.xml were all accurate).

It turns out my problem was being caused by the inclusion of the Apache commons jar files; I've not identified which one in particular caused the issue yet, but after removing the following jars as dependencies from the project the error's stopped appearing:

  • commons-codec-1.3.jar
  • commons-fileupload-1.2.jar
  • commons-httpclient-3.1.jar
  • commons-io-1.4.jar
  • commons-lang-2.1.jar
  • commons-logging-1.1.1.jar

Looking at this list it appears the "commons-codec-1.3.jar" and "commons-logging-1.1.1.jar" jars are common between my setup and yours, so maybe start by removing one or both of these and see what difference that makes?

Edit: I've hit the problem again in another project which had commons-logging-1.1.1.jar present in the web application, and removing this has stopped the error from appearing.

Upvotes: 1

Related Questions