Announcement Announcement Module
No announcement yet.
Not found a definite guide to solve the exception :| Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not found a definite guide to solve the exception :|

    Hi everyone,
    I'm facing an (ugly and hideous) exception which is spread all over the web and forums and people are talking about it but after two days working on it, I proudly say that "I Give Up"!

    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(
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(
    	at org.apache.catalina.core.StandardContext.listenerStart(
    	at org.apache.catalina.core.StandardContext.start(
    	at org.apache.catalina.core.ContainerBase.start(
    	at org.apache.catalina.core.StandardHost.start(
    	at org.apache.catalina.core.ContainerBase.start(
    	at org.apache.catalina.core.StandardEngine.start(
    	at org.apache.catalina.core.StandardService.start(
    	at org.apache.catalina.core.StandardServer.start(
    	at org.apache.catalina.startup.Catalina.start(
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    	at java.lang.reflect.Method.invoke(
    	at org.apache.catalina.startup.Bootstrap.start(
    	at org.apache.catalina.startup.Bootstrap.main(
    I'm using "STS Version: 2.8.1.RELEASE" to run a simple spring web MVC, I'm sure there's no flaw or any bug in the source code, because I used "Netbeans" to run the same source code on my Apache Tomcat 6 and Apache Tomcat 7.0.2 and it worked properly.

    As I tried to migrate from "Netbeans" to "STS" which is built upon the vanilla eclipse, I'm on the edge of the disappointment that "a day comes where people can happily run their hellowords in eclipse and above that STS".

    I've googled this issue and have visited tons of forums and pages either they are suggesting include some old nasty jar files ( aka "spring.jar") or change some maven configuration. neither of both works for me. because:
    a)I'm not maven fan and I do not use it.
    b)I'm using the Spring release 3.1.0 RC1 and the jar files they recommend to include in the build path, is really old

    I believe someone has solved this issue with tomcat before but unfortunately I could not find a well documented solution or an easy to follow HOW-TO.

    further information that may help :
    - I once imported "exactly" same jar files included by "Netbeans" when I was creating the project inside "Netbeans" IDE, in my build path inside "STS" and got the same exception, again with Vfabric server and Apache Tomcat 6.0 (I believe there are not much difference between these two and I may be wrong)
    - at other times I just include only the Spring 3.1.0 RC1 jar files and Apache Commong Logging 1.1.1 jar files and compiled and run the project against Apache Tomcat 6, again same issue.

    the question is what it takes to get rid of this exception inside STS and clipse for god sake?
    what is it that makes it work in Netbeans nicely with Apache Tomcat 6 and 7.0.2?!

    I'm really looking forward for replies to this thread from the respectful spring community.
    regards ramtin.

  • #2
    STS (or eclipse for that matter) use different ways of resolving/using libraries/jar files. As I (and others with me) stated in many other posts on this forum is that if something is on your compilation class path is doesn't mean it is on your RUNTIME class path.

    Make sure your application is detected as a web project (it probably is if you try to deploy it to inside eclipse). Next make sure that your jars are on your build path (all jars needed including the spring-web and spring-webmvc jars). Next goto your projects property settings and make sure that all the needed jars are exported as J(2)EE libraries, if not they are not available on your class path.

    As I tried to migrate from "Netbeans" to "STS" which is built upon the vanilla eclipse, I'm on the edge of the disappointment that "a day comes where people can happily run their hellowords in eclipse and above that STS".
    That day is already here but still people to refuse using maven/ant+ivy/gradle to manage their build and dependencies. Instead people still love to create IDE dependent builds. Which is also what IMHO is the case here.


    • #3
      thank you sir for your kind answer,
      you were right there are some ambiguities when working with jar files and putting ( aka configuring the project class path) them in the right place, anyway the problem was solved in this way:
      I copied all spring 3.1.0 framework + apache common logging jar files in the "lib" folder which resides in the "/WEB-INF/lib/" manually (either drag drop files inside STS or using file browser)
      that did the trick.
      well it was kind of weird for programmers who got used to Netbeans.
      anyway I'm having second thoughts about maven after the hell I've been through
      thanks for your time.


      • #4
        Well maven will give you, probably, another hell. I prefer ant+ivy and lately Gradle.

        In general eclipse follows the 'normal' web app layout and adds the libraries to the build path which are in the WEB-INF/lib. It has been a while since I used Netbeans (I cannot get used to it) but that works with libraries and jars and then adds them to the lib folder (the other way around if I'm not totally mistaken).