spring - java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet -
i using spring 3.1.0.release, , servlet container tomcat 7 , ide eclipse indigo , jar spring-webmvc-3.1.0.release.jar contains dispatcherservlet exists in lib folder, , yet when running application, getting exception:
java.lang.classnotfoundexception: org.springframework.web.servlet.dispatcherservlet @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1678) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1523) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:525) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:507) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:126) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1099) @ org.apache.catalina.core.standardwrapper.load(standardwrapper.java:1043) @ org.apache.catalina.core.standardcontext.loadonstartup(standardcontext.java:4957) @ org.apache.catalina.core.standardcontext$3.call(standardcontext.java:5284) @ org.apache.catalina.core.standardcontext$3.call(standardcontext.java:5279) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:662)
please advise why getting exception, , how fix it.
edit: following configuration files:
1- .springbeans:
<?xml version="1.0" encoding="utf-8"?> <beansprojectdescription> <version>1</version> <pluginversion><![cdata[2.9.0.201203011806-release]]></pluginversion> <configsuffixes> <configsuffix><![cdata[xml]]></configsuffix> </configsuffixes> <enableimports><![cdata[false]]></enableimports> <configs> <config>src/main/webapp/web-inf/checkout-servlet.xml</config> </configs> <configsets> </configsets> </beansprojectdescription>
2- web.xml:
<web-app> <display-name>checkout</display-name> <servlet> <servlet-name>checkout</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>checkout</servlet-name> <url-pattern>*.action</url-pattern> </servlet-mapping> </web-app>
3- checkout-servlet.xml:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <context:component-scan base-package="com.myapp"/> <bean id="myservice" class="com.myapp.myservice"/> </beans>
also when trying access page in application, exception:
http status 404 - servlet checkout not available type status report message servlet checkout not available description requested resource (servlet checkout not available) not available. apache tomcat/7.0.22
you need add "maven dependency" in deployment assembly
- right click on project , choose properties.
- click on deployment assembly.
- click add
- click on "java build path entries"
- select maven dependencies"
- click finish.
rebuild , deploy again
note: applicable non maven project.