Eclipse + Maven + JavaServer Faces -> ClassNotFoundException: StartupServletContextListener
**Summary**
 
When I try to run a JSF 2.0 application from within Eclipse (on Tomcat 7.0) I get the following exception:

    Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

**Details** 

I'm learning to develop JSF applications, using Eclipse.
I started with a preconfigured Eclipse project: File->New->Dynamic Web Project->JavaServer Face v2.0 Project. 
Using this method Eclipse provides all dependencies. But I want to really learn how everything works. I want to remove the "magic", so I converted my project to a Maven project: Configure->Convert to Maven project.

I then created my pom.xml (based on [http://myfaces.apache.org/build-tools/archetypes/myfaces-archetype-helloworld20/index.html][1]), it contains the following:

    <build>
    	<finalName>jsf-facelets-tutorial</finalName>
    	<plugins>
    		<plugin>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-war-plugin</artifactId>
    			<configuration>
    				<webXml>WebContent/WEB-INF/web.xml</webXml>
    			</configuration>
    		</plugin>
    		<plugin>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-compiler-plugin</artifactId>
    			<configuration>
    				<source>1.6</source>
    				<target>1.6</target>
    			</configuration>
    		</plugin>
    	</plugins>
    </build>
    <dependencies>
    	<dependency>
    		<groupId>javax.el</groupId>
    		<artifactId>el-api</artifactId>
    		<version>1.0</version>
    		<scope>provided</scope>
    	</dependency>
    	<dependency>
    		<groupId>junit</groupId>
    		<artifactId>junit</artifactId>
    		<version>4.0</version>
    		<scope>test</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.apache.myfaces.core</groupId>
    		<artifactId>myfaces-api</artifactId>
    		<version>2.0.5</version>
    		<scope>compile</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.apache.myfaces.core</groupId>
    		<artifactId>myfaces-impl</artifactId>
    		<version>2.0.5</version>
    		<scope>runtime</scope>
    	</dependency>
    </dependencies>

But because I'm unfamiliar with JSF, and because this is an Eclipse "Dynamic Web Project", the project structure is new to me and I'm having trouble understanding which dependencies are coming from Maven and which are provided by the Eclipse "magic".

In Eclipse, my project structure is as follows:

    ProjectName
      JAX-WS Web Services <-- CAN I REMOVE THIS???
      Deployment Descriptor
      Java Resources
        src/main
        Libraries
          Apache Tomcat v7.0
            el-api.jar
            jsp-api.jar
            [more...]
          JSF 2.0 (Apache MyFaces JSF Core-2.0 API 2.0.2) <-- I REMOVED THIS!!!
          EAR Libraries
          JRE System Library
          Maven Dependencies
            el-api-1.0.jar
            myfaces-api-2.0.5.jar
            myfaces-impl-2.0.5.jar
            [more...]
          Web App Libraries

**Problem**
My (very basic) application (login page & welcome page) no longer runs.
When I do the following:

    (1) Right click on WebContent/login.xhtml
    (2) Run as -> Run on Server
    (3) Apache Tomcat v7.0 - JDK6 at localhost

I get the exception:

    Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

I have the feeling that this is very easy to fix, but I'm too unfamiliar with these frameworks to work it out.

If there are any additional details I should provide (web.xml, faces-config-xml, login.xhtml), let me know and I'll add them.

Thanks!

[1]: http://myfaces.apache.org/build-tools/archetypes/myfaces-archetype-helloworld20/index.html
Eclipse + Maven + JavaServer Faces -> ClassNotFoundException: StartupServletContextListener
===

**Summary**
 
When I try to run a JSF 2.0 application from within Eclipse (on Tomcat 7.0) I get the following exception:

    Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

**Details** 

I'm learning to develop JSF applications, using Eclipse.
I started with a preconfigured Eclipse project: File->New->Dynamic Web Project->JavaServer Face v2.0 Project. 
Using this method Eclipse provides all dependencies. But I want to really learn how everything works. I want to remove the "magic", so I converted my project to a Maven project: Configure->Convert to Maven project.

I then created my pom.xml (based on [http://myfaces.apache.org/build-tools/archetypes/myfaces-archetype-helloworld20/index.html][1]), it contains the following:

    <build>
    	<finalName>jsf-facelets-tutorial</finalName>
    	<plugins>
    		<plugin>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-war-plugin</artifactId>
    			<configuration>
    				<webXml>WebContent/WEB-INF/web.xml</webXml>
    			</configuration>
    		</plugin>
    		<plugin>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-compiler-plugin</artifactId>
    			<configuration>
    				<source>1.6</source>
    				<target>1.6</target>
    			</configuration>
    		</plugin>
    	</plugins>
    </build>
    <dependencies>
    	<dependency>
    		<groupId>javax.el</groupId>
    		<artifactId>el-api</artifactId>
    		<version>1.0</version>
    		<scope>provided</scope>
    	</dependency>
    	<dependency>
    		<groupId>junit</groupId>
    		<artifactId>junit</artifactId>
    		<version>4.0</version>
    		<scope>test</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.apache.myfaces.core</groupId>
    		<artifactId>myfaces-api</artifactId>
    		<version>2.0.5</version>
    		<scope>compile</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.apache.myfaces.core</groupId>
    		<artifactId>myfaces-impl</artifactId>
    		<version>2.0.5</version>
    		<scope>runtime</scope>
    	</dependency>
    </dependencies>

But because I'm unfamiliar with JSF, and because this is an Eclipse "Dynamic Web Project", the project structure is new to me and I'm having trouble understanding which dependencies are coming from Maven and which are provided by the Eclipse "magic".

In Eclipse, my project structure is as follows:

    ProjectName
      JAX-WS Web Services <-- CAN I REMOVE THIS???
      Deployment Descriptor
      Java Resources
        src/main
        Libraries
          Apache Tomcat v7.0
            el-api.jar
            jsp-api.jar
            [more...]
          JSF 2.0 (Apache MyFaces JSF Core-2.0 API 2.0.2) <-- I REMOVED THIS!!!
          EAR Libraries
          JRE System Library
          Maven Dependencies
            el-api-1.0.jar
            myfaces-api-2.0.5.jar
            myfaces-impl-2.0.5.jar
            [more...]
          Web App Libraries

**Problem**
My (very basic) application (login page & welcome page) no longer runs.
When I do the following:

    (1) Right click on WebContent/login.xhtml
    (2) Run as -> Run on Server
    (3) Apache Tomcat v7.0 - JDK6 at localhost

I get the exception:

    Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

I have the feeling that this is very easy to fix, but I'm too unfamiliar with these frameworks to work it out.

If there are any additional details I should provide (web.xml, faces-config-xml, login.xhtml), let me know and I'll add them.

Thanks!

[1]: http://myfaces.apache.org/build-tools/archetypes/myfaces-archetype-helloworld20/index.html