spring - Tomcat, java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet -
i'm trying use spring-mvc. create maven project, add dependency. using tomcat 7, , eclipse luna. , have exception:
java.lang.classnotfoundexception: org.springframework.web.servlet.dispatcherservlet @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1720) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:506) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:488) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:115) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1148) @ org.apache.catalina.core.standardwrapper.load(standardwrapper.java:1087) @ org.apache.catalina.core.standardcontext.loadonstartup(standardcontext.java:5262) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5550) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source)
i tried find solution of problem. solutions found identical, this: https://stackoverflow.com/a/12910916/3601615 didn't me. may did wrong?
it's pom file dependency:
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>4.1.4.release</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>4.1.4.release</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>4.1.4.release</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>4.1.4.release</version> <scope>provided</scope> </dependency>
and web.xml :
<servlet> <servlet-name>helloweb</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>helloweb</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
remove <scope>provided</scope>
dependency isnt provided tomcat. tag keeps maven exporting dependency. used dependencies provided target system , dont need exported (in case lib found in tomcat7dir/lib).
Comments
Post a Comment