java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener

25,810

Solution 1

For this error, there can be different solutions. I have noted down the ones that had worked for me.

Solution 1. This is always happened in deployment and debugging environment. In deployment environment, just make sure your server classpath has included the Spring jar library (e.g spring-4.0.4.jar).

In debugging environment, the steps may vary from different IDE, but the solution is same. In Eclipse, developers usually will create a tomcat, jboss…whatever application server for debugging, just make sure the correct Spring jars are included.

  1. Double click on your debugging server Click on the “Open launch
  2. configuration” to access the server environment Click on the classpath tab Include the Spring jar file here , it may also required common log jar due to Spring dependency.
  3. Done, run your application again.

.

Solution 2. If you are using Maven as a build tool and downloading dependencies using it, there can be some jar conflict. Because Tomcat servers normally provide some jars such as servlet-api and jpa-api. So if you again included them using maven; there will be problems in identifying them.

Solution 3. If you are using Eclipse as your IDE and using Maven as your build tool and tomcat as your server; remember Tomcat server will not look on the jars which are just inside the folders. For that there's a small trick,

  1. Right click on your project and select properties From the displayed window,

  2. select Deployment Assembly

  3. Select Add

  4. Add Maven dependencies

  5. Click Apply and Click OK

Hope one of these solutions would help you to solve your problem. Happy Coding and make sure that is using Java.

Solution 2

In eclipse -> Your Project -> Properties -> Java Build Path -> Order and Export -> check Maven Dependencies. Or in WebProject -> Your Project -> Properties -> Deployment assambly -> check Maven Dependencies. This work in my case.

Solution 3

Project Properties

I had the same issue, but I fixed by adding Maven Dependencies. It was missing for some reason, and I have no clue

Share:
25,810
Shelly
Author by

Shelly

Updated on July 09, 2022

Comments

  • Shelly
    Shelly almost 2 years

    Well, i'm trying to Run my web application in tomcat, but i got the following error:

    Nov 18, 2013 12:19:35 AM org.apache.catalina.core.StandardContext listenerStart
    Grave: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
    java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4638)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
    

    My project works with and some classes have strange errors, like this: "JOIN FETCH expressions cannot be defined with an identification variable.". When i run "Maven --> Update Project" the error in "JOIN FETCH.." disappear but i continue don't get start my server.

    EDIT 1: My pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>br.com.sender</groupId>
        <artifactId>Sender</artifactId>
        <packaging>war</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>sender App</name>
        <url>http://maven.apache.org</url>
        <properties>
            <org.springframework.version>3.0.6.RELEASE
            </org.springframework.version>
        </properties>
        <dependencies>
    
            <dependency>
                <groupId>org.primefaces.extensions</groupId>
                <artifactId>primefaces-extensions</artifactId>
                <version>0.7.1</version>
            </dependency>
    
    
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>2.1.6</version>
            </dependency>
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-impl</artifactId>
                <version>2.1.6</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
    
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
            </dependency>
    
    
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>persistence-api</artifactId>
                <version>1.0</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-expression</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <!-- Spring Security -->
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>3.4.0.GA</version>
            </dependency>
            <dependency>
                <groupId>c3p0</groupId>
                <artifactId>c3p0</artifactId>
                <version>0.9.1.2</version>
            </dependency>
            <dependency>
                <groupId>cglib</groupId>
                <artifactId>cglib-nodep</artifactId>
                <version>2.2.2</version>
            </dependency>       
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>4.0.2.GA</version>
            </dependency>
            <dependency>
                <groupId>postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>9.1-901.jdbc4</version>
            </dependency>
            <dependency>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.12.1.GA</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.6.1</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.6.1</version>
            </dependency>
            <dependency>
                <groupId>asm</groupId>
                <artifactId>asm-commons</artifactId>
                <version>3.1</version>
            </dependency>
            <dependency>
                <groupId>net.sf.ehcache</groupId>
                <artifactId>ehcache</artifactId>
                <version>2.7.4</version>
            </dependency>
    
            <dependency>
                <groupId>org.primefaces</groupId>
                <artifactId>primefaces</artifactId>
                <version>3.5</version>
            </dependency>
    
            <dependency>
                <groupId>org.primefaces.themes</groupId>
                <artifactId>bootstrap</artifactId>
                <version>1.0.9</version>
            </dependency>
    
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
    
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.4</version>
            </dependency>
    
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.3</version>
            </dependency>
    
    
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>jsr250-api</artifactId>
                <version>1.0</version>
            </dependency>
        </dependencies>
    
        <repositories>
            <repository>
                <id>prime-repo</id>
                <name>PrimeFaces Maven Repository</name>
                <url>http://repository.primefaces.org</url>
                <layout>default</layout>
            </repository>
    
            <repository>
                <id>java.net2</id>
                <name>Java.net</name>
                <url>https://oss.sonatype.org/content/repositories/java.net2</url>
            </repository>
        </repositories>
    
        <build>
            <finalName>sender</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <targetJdk>1.6</targetJdk>
                    </configuration>
                </plugin>
            </plugins>
            <resources>
             <resource>
                <directory>src/main/resources</directory>
             </resource>
            </resources>
        </build>
    </project>