Eclipse+Maven+Spring,按照教程去做第一个Sample.
在Tomcat中执行出现:
Servlet.init() for servlet MyDispatcherServlet threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet MyDispatcherServlet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\ItDevelop\Tomcat7\webapps\Spring-MVC-0.0.1-SNAPSHOT\WEB-INF\classes\controller\MyController.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:281)
org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentS
代码参考例子: https://github.com/khyiu/Spring-MVC-Tutorials
原文:http://kh-yiu.blogspot.com/2012/05/quick-tutorial-to-spring-mvc-with-maven.html
请问哪里配置不对吗? 多谢
eclipse spring servlet
------解决方案--------------------
缺少jar包或者jar包冲突导致的,你的war包中的lib文件下不可能只有spring的jar包,还有相关的辅助jar包呢。
虽然你使用maven管理的依赖,但是我觉得你打war的过程中丢失了很多jar吧,可以看源工程下的jar和打出war包的jar是否一样?
------解决方案--------------------
maven去掉,单独测试下看是否报错。
------解决方案--------------------
搜下资料学习下,刚开始先一个框架的搞明白,然后再框架整合。
------解决方案--------------------
参考:
http://blog.csdn.net/sunitjy/article/details/6782431
http://javacrazyer.iteye.com/blog/790834
------解决方案--------------------
看下官方说明,应该和哪个jar包合并了吧