Announcement Announcement Module
Collapse
No announcement yet.
Not found a definite guide to solve the exception :| Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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"!

    Code:
    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:1680)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4149)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    	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:289)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    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.

    Code:
    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.

    Comment


    • #3
      hi
      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.

      Comment


      • #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).

        Comment

        Working...
        X