在用Eclipse和Maven构建SpringMVC项目中,
Maven Dependencies中已经有了spring-webmvc的jar包,
并且在其中也有org.springframework.web.context.ContextLoaderListener类,但是运行的时候出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener问题,
原因不知道,
解决办法参考http://stackoverflow.com/questions/21237339/java-lang-classnotfoundexception-org-springframework-web-context-contextloaderl
和http://commonexceptions.blogspot.jp/2014/01/java.html。
解决步骤:
1.Open project properties;
2.Select "Deployment Assembly"
3.Click "Add..." button on the right navigation
4.Select "Java Build Path Entries" from menu of Directive Type and then click "Next"
5.Select "Maven Dependencies" from Java Build Path Entries menu and then click "Finish"
猜测原因可能是因为没有把Maven Dependencies添加到依赖路径中。
然后在删除Server中的服务器,最后CLean Project和Build Project,可能需要重启Eclipse。