Announcement Announcement Module
Collapse
No announcement yet.
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListe n Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListe n

    why am i getting this exception?

  • #2
    Because the classcannot be found... That is why it as a ClassNotFoundException include the spring-web and spring-webmvc jar in your WEB-INF/lib...

    Comment


    • #3
      yes,i was missing,spring-web
      but what is the last version of it?

      Comment


      • #4
        I'm not sure why you would be asking that, but I believe that after Spring 2.5.6, the distribution provides several different jar files, separating the functionality into distinct modules. The latest available release is 3.0.2. In Spring 3.0.2, this class is in "org.springframework.web-3.0.2.RELEASE.jar". Whatever you do, make sure that you use the version corresponding to the other Spring classes that you're using. Don't install the 3.0.2 version if you're using 3.0.0. If you're using Spring 2.5.6, then the class is already provided in the main "spring.jar" (which leads me to assume you're using a version later than that).

        Comment


        • #5
          um asking that because um using the version 3.0.0 and tried to add spring-web to the pom file and the exception still there.

          Comment


          • #6
            It looks like there is a space in the class name (at least it appears there is a space between the e and the n of the title of this thread)....perhaps that is why the class cannot be found. Did you ensure that your web.xml does not have a space in the class name?

            HTH,
            Rob

            Comment


            • #7
              the include is right,but still doesn't work and the exception still there,why?
              Code:
              <properties>
              		<spring.version>3.0.2.RELEASE</spring.version>
              		<spring-security.version>3.0.2.RELEASE</spring-security.version> 
              		<tiles.version>2.1.3</tiles.version>
              	</properties>
              
              <dependencies>
              <dependency>
              			<groupId>org.springframework</groupId>
              			<artifactId>spring-web</artifactId> 
              			<version>${spring.version} </version> 
              </dependency>
              </dependencies>
              Last edited by ylazez; Apr 27th, 2010, 10:56 AM.

              Comment


              • #8
                Post the full stacktrace and your web.xml...

                Comment


                • #9
                  the trace:

                  Code:
                   ClassNotFoundException while loading persisted sessions: java.lang.ClassNotFoundException: org.springframework.security.core.context.SecurityContextImpl
                  java.lang.ClassNotFoundException: org.springframework.security.core.context.SecurityContextImpl
                  	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
                  	at java.security.AccessController.doPrivileged(Native Method)
                  	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                  	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                  	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
                  	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
                  	at java.lang.Class.forName0(Native Method)
                  	at java.lang.Class.forName(Class.java:247)
                  	at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
                  	at org.apache.catalina.util.CustomObjectInputStream.resolveClass(CustomObjectInputStream.java:78)
                  	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
                  	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
                  	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
                  	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
                  	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
                  	at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441)
                  	at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942)
                  	at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
                  	at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
                  	at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
                  	at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
                  	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4358)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                  	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                  	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                  	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
                  	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:413)
                  Apr 28, 2010 3:48:19 PM org.apache.catalina.session.StandardManager start
                  SEVERE: Exception loading sessions from persistent storage
                  java.lang.ClassNotFoundException: org.springframework.security.core.context.SecurityContextImpl
                  	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
                  	at java.security.AccessController.doPrivileged(Native Method)
                  	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                  	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                  	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
                  	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
                  	at java.lang.Class.forName0(Native Method)
                  	at java.lang.Class.forName(Class.java:247)
                  	at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
                  	at org.apache.catalina.util.CustomObjectInputStream.resolveClass(CustomObjectInputStream.java:78)
                  	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
                  	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
                  	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
                  	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
                  	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
                  	at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441)
                  	at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942)
                  	at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
                  	at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
                  	at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
                  	at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
                  	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4358)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                  	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                  	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                  	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
                  	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:413)
                  Apr 28, 2010 3:48:19 PM org.apache.catalina.core.StandardContext listenerStart
                  SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
                  java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
                  	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
                  	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
                  	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3877)
                  	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
                  	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                  	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                  	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                  	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
                  	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:413)

                  Comment


                  • #10
                    the pom.xml file:

                    Code:
                    <?xml version="1.0" encoding="UTF-8"?>
                    <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>com.App</groupId>
                    	<artifactId>app</artifactId>
                    	<name>myApp web app</name>
                    	<packaging>war</packaging>
                    	<version>1.0.0-SNAPSHOT</version>
                    
                    	<properties>
                    		<spring.version>3.0.0.RELEASE</spring.version>
                    		<spring-security.version>3.0.2.RELEASE</spring-security.version>
                    		<tiles.version>2.1.3</tiles.version>
                    	</properties>
                    
                    	<dependencies>
                    		<!-- Compile dependencies -->
                    		<dependency>
                    			<groupId>javax.servlet</groupId>
                    			<artifactId>jstl</artifactId>
                    			<version>1.2</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>javax.mail</groupId>
                    			<artifactId>mailapi</artifactId>
                    			<version>1.4.2</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>log4j</groupId>
                    			<artifactId>log4j</artifactId>
                    			<version>1.2.15</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.tuckey</groupId>
                    			<artifactId>urlrewritefilter</artifactId>
                    			<version>3.1.0</version>
                    		</dependency>
                    		<!-- Spring -->
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-core</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-expression</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-beans</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-aop</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-context</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    		
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-web</artifactId>
                    			<version>${spring.version}</version> 
                    		</dependency>
                    
                    		<!-- New Dependencies -->
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-context-support</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-tx</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-jdbc</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-orm</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-oxm</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-web</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-webmvc</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-webmvc-portlet</artifactId>
                    			<version>${spring.version}</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>org.springframework</groupId>
                    			<artifactId>spring-test</artifactId>
                    			<version>${spring.version}</version>
                    			<scope>test</scope>
                    		</dependency>
                    
                    		<!-- Container-provided dependencies-->
                    		<dependency>
                    			<groupId>javax.servlet</groupId>
                    			<artifactId>servlet-api</artifactId>
                    			<version>2.4</version>
                    			<scope>provided</scope>
                    		</dependency>
                    		<dependency>
                    			<groupId>javax.servlet.jsp</groupId>
                    			<artifactId>jsp-api</artifactId>
                    			<version>2.1</version>
                    			<scope>provided</scope>
                    		</dependency>
                    		<!-- Test dependencies -->
                    		<dependency>
                    			<groupId>junit</groupId>
                    			<artifactId>junit</artifactId>
                    			<version>4.7</version>
                    			<scope>test</scope>
                    		</dependency>
                    		<!-- Data access dependencies -->
                    		<dependency>
                    			<groupId>commons-dbcp</groupId>
                    			<artifactId>commons-dbcp</artifactId>
                    			<version>1.2.2</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>javax.persistence</groupId>
                    			<artifactId>persistence-api</artifactId>
                    			<version>1.0</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.hibernate</groupId>
                    			<artifactId>hibernate-core</artifactId>
                    			<version>3.3.1.GA</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.hibernate</groupId>
                    			<artifactId>hibernate-annotations</artifactId>
                    			<version>3.4.0.GA</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.hibernate</groupId>
                    			<artifactId>hibernate-entitymanager
                                </artifactId>
                    			<version>3.4.0.GA</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>hibernate-commons-annotations
                                </groupId>
                    			<artifactId>hibernate-commons-annotations
                                </artifactId>
                    			<version>3.0.0.GA</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>javax.transaction</groupId>
                    			<artifactId>jta</artifactId>
                    			<version>1.1</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>antlr</groupId>
                    			<artifactId>antlr</artifactId>
                    			<version>2.7.7</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>dom4j</groupId>
                    			<artifactId>dom4j</artifactId>
                    			<version>1.6.1</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>hsqldb</groupId>
                    			<artifactId>hsqldb</artifactId>
                    			<version>1.8.0.2</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>commons-collections</groupId>
                    			<artifactId>commons-collections</artifactId>
                    			<version>3.2</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>commons-logging</groupId>
                    			<artifactId>commons-logging</artifactId>
                    			<version>1.1.0.jboss</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>commons-codec</groupId>
                    			<artifactId>commons-codec</artifactId>
                    			<version>1.3</version>
                    		</dependency>
                    
                    		<dependency>
                    			<groupId>commons-lang</groupId>
                    			<artifactId>commons-lang</artifactId>
                    			<version>2.3</version>
                    		</dependency>
                    
                    
                    		<dependency>
                    			<groupId>org.slf4j</groupId>
                    			<artifactId>slf4j-api</artifactId>
                    			<version>1.5.6</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.slf4j</groupId>
                    			<artifactId>slf4j-log4j12</artifactId>
                    			<version>1.5.6</version>
                    		</dependency>
                    		<!-- Spring Security -->
                    		<dependency>
                    			<groupId>org.springframework.security</groupId>
                    			<artifactId>spring-security-core</artifactId>
                    			<version>${spring-security.version}</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.springframework.security</groupId>
                    			<artifactId>spring-security-web</artifactId>
                    			<version>${spring-security.version}</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.springframework.security</groupId>
                    			<artifactId>spring-security-config</artifactId>
                    			<version>${spring-security.version}</version>
                    		</dependency>
                    		<dependency>
                    			<groupId>org.springframework.security</groupId>
                    			<artifactId>spring-security-taglibs</artifactId>
                    			<version>${spring-security.version}</version>
                    		</dependency>
                    		<!-- Spring Upload -->
                    
                    		<dependency>
                    			<groupId>commons-fileupload</groupId>
                    			<artifactId>commons-fileupload</artifactId>
                    			<version>1.2.1</version>
                    		</dependency>
                    		
                    		<dependency>
                                <groupId>org.apache.commons</groupId>
                                <artifactId>commons-io</artifactId>
                                <version>1.3.2</version>
                            </dependency>
                            
                            <dependency>
                          <groupId>taglibs</groupId>
                          <artifactId>standard</artifactId>
                          <version>1.1.2</version>
                          </dependency>
                    
                    
                    
                    	</dependencies>
                    
                    	<build>
                    		<plugins>
                    			<plugin>
                    				<groupId>org.apache.maven.plugins</groupId>
                    				<artifactId>maven-compiler-plugin</artifactId>
                    				<configuration>
                    					<source>1.5</source>
                    					<target>1.5</target>
                    				</configuration>
                    			</plugin>
                    			<plugin>
                    				<groupId>org.apache.maven.plugins</groupId>
                    				<artifactId>maven-dependency-plugin</artifactId>
                    				<executions>
                    					<execution>
                    						<id>install</id>
                    						<phase>install</phase>
                    						<goals>
                    							<goal>sources</goal>
                    						</goals>
                    					</execution>
                    				</executions>
                    			</plugin>
                    		</plugins>
                    	</build>
                    	<repositories>
                    		<repository>
                    			<id>first</id>
                    			<name>first</name>
                    			<url>http://repo1.maven.org/maven2</url>
                    			<layout>default</layout>
                    		</repository>
                    		<repository>
                    			<id>second</id>
                    			<name>second</name>
                    			<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
                    			<layout>default</layout>
                    		</repository>
                    		<repository>
                    			<id>jboss</id>
                    			<name>jboss</name>
                    			<url>http://repository.jboss.com/maven2/</url>
                    			<layout>default</layout>
                    		</repository>
                    		<repository>
                    			<id>additional</id>
                    			<name>additional</name>
                    			<url>http://maven.jahia.org/maven2</url>
                    			<layout>default</layout>
                    		</repository>
                    	</repositories>
                    </project>

                    Comment


                    • #11
                      Check the actual war file contents, make sure it contains the the expected jar and that none of them are corrupt.

                      Comment


                      • #12
                        It looks to me like you're missing the spring-security dependency in your pom.xml. That's a separate module.

                        Comment


                        • #13
                          Given the stack trace provided, it appears the ContextLoaderListener is specified without a space in the web.xml. I might suggest, as Marten suggested, for you to include the web.xml as it might assist in figuring out the issue you are encountering.

                          I don't suppose there are other stack traces found in the logs?

                          The stack suggests you are deploying to tomcat, are there any Spring jars (or other non-standard jars) in your tomcat shared lib? If so, try removing them. You may even try a fresh tomcat install...I noticed tomcat is failing to load persistent sessions from storage too.

                          Have you checked the directory the application is deployed to and ensured that it contains the spring-web jar in the lib directory (i.e. TOMCAT_HOME/webapps/app/WEB-INF/lib)? Have you opened that jar with a zip program (i.e. winzip) to ensure it cotains the ContextLoaderListener class?

                          Comment


                          • #14
                            I have the same error!

                            When i did a full reinstall of STS and created a basic Roo project i was able to run it on the tc server fine. Then when i tried to run it on a tomcat server, it failed, so then i deleted the tomcat server and tried to run the tc server again... but no deal! it keeps showing this message:

                            SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListe ner
                            java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListe ner

                            i have tried everything in the forums but cant get it to run again...
                            any ideas??

                            Comment


                            • #15
                              Right click on tomcat server and click on clean.This will clean all the previous publishing on the server. Now do a clean , build and start the server. You will get everything working

                              Comment

                              Working...
                              X