• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

ClassNotFoundException: DispatcherServlet

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was trying to do my first program in Spring MVC. I referred the below tutorial for helloworld example

http://blog.springsource.org/2011/01/04/green-beans-getting-started-with-spring-mvc/

I got the below exception on startup of server:

WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Beginer' did not find a matching property.
May 05, 2013 5:53:12 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet appServlet as unavailable
May 05, 2013 5:53:12 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /Beginer threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Since i am learning, i took 1 jar at a time to understand the imports better. I am Using STS IDE. I added 3 jars to start with. ( I know i might require other jars, but trying to tackle exception and resolve one by one). Below are the jars that i added in build path of the project:

1. spring-context-3.2.2
2. spring-web-3.2.2
3. spring-webmvc-3.2.2

Spring-webmvc has DispatcherServlet. I double checked classpath and it also had all the 3 jars added. I am confused why this error should be thrown. Can somebody please clarify. My goal is to resolve this exception, though i might get another one after this.


Regards.
Pradeep
 
pradeep chellappan rm
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to identify the cause.

I was literally adding all the jars directly in system folders instead of STS projectexplorer/navigator WEB-INF/lib. This is still a surprise why it won't accept if i add it in sytem folder under the exact location. I got multiple exception since i was adding one jar at a time and finally got my HelloWorld.

Thanks.
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System folder jars are used to identify the classes at compile time but at run time all the classes must be present in the lib folder.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic