1

I have been struggling with this problem for a few days now (That is why I am providing GitHub link). Here is the stack trace:

    SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoadListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoadListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I will point only, that I use Tomcat 7 and I run the server from Servers tab in Eclipse.

I have read everything in the Internet about it. The most common solution provided was:

"Go to project properties -> Deployment Assembley, click Add... , select Java Build Path Entries and add the Maven Dependencies to the Web Deployment Assembly."

And it does not work for me, same as other solutions in the Internet I have seen so far. I am hopeless.

I am providing GitHub link to my project: https://github.com/wiewioraseb/beer-blog-hiccup.git I already tried to export it to another computer, I still get the same error while running it on the other machine.

5
  • Sometimes cleaning tomcat resolves the Issue. And Do you see "Maven Dependencies" folder in your project libraries? Commented Mar 3, 2015 at 16:20
  • @SRy I have done that already unfortunately. I see Maven Dependencies in my project library. Commented Mar 3, 2015 at 16:38
  • can you post your project structure here? Commented Mar 3, 2015 at 16:42
  • @SRy Here you go s10.postimg.org/ckjrs4ogp/project.jpg Commented Mar 3, 2015 at 16:50
  • For me your deployment assembly looks wrong. Maven project structure should be src/main/java. Check your deployment assembly looking like this google.com/imgres?imgurl=https://i.sstatic.net/…. And remove tomcat 7 library from classpath. Commented Mar 3, 2015 at 16:57

3 Answers 3

1

The correct listener class to bootstrap Spring root context is ContextLoaderListener, not ContextLoadListener! So in web.xml should be:

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Sign up to request clarification or add additional context in comments.

1 Comment

I`m embarrassed now, Sorry for inconvenience! And thank you for your answer.
0

The link says: In deployment environment, just make sure your server classpath has included the Spring jar library (e.g spring-2.5.6.jar).

For Spring3, ContextLoaderListener is moved to spring-web.jar, you can get the library from Maven central repository.

<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-web</artifactId>
		<version>3.0.5.RELEASE</version>
</dependency>

2 Comments

Do you mean to copy spring-2.5.6.jar (or spring-web-4.1.5.RELEASE.jar) to C:\something\Tomcat7\lib directory? If not, where can I find server classpath?
But If OP exactly used the POM.xml whatever he copied from github link, he doesn't need to do anything. I suspect OP is missing some configuration.
0

Are you sure your build path (within eclipse) actually includes all the dependencies (in this case specifically spring-web und spring-webmvc)? If you build a *.war file, using mvn clean install, the libraries will probably be included in it, if you unpack it.

However, this is not the same as Eclipse. Therefore I suggest running mvn clean install eclipse:clean eclipse:eclipse within your directory. Then refresh the project in Eclipse and clean it as well (Project -> Clean).

To see if libraries are deployed properly, double click on your server and go to this location (in your workspace folder):

tomcat eclipse directory

and check for the dependencies (*.jar files) inside your WEB-INF/lib folder.

Generally this fixes the problem for me. You should:

  • close the server in Eclipse
  • rightclick -> clean -> clean Tomcat Work Directory
  • run the commands above
  • start the server

2 Comments

I made a .war file and unpacked it to check if the libraries are there. Everything is fine with it. I have already cleaned the directory, didn`t help ;(
I checked if the libraries are there: C:\something\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\beer-blog-hiccup\WEB-INF\lib and they are all in place. @Schaka

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.