1. 部署springmvc项目后,tomcat起不来,报以下错误:
Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVC]]
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;
严重: The required Server component failed to start so Tomcat is unable to start.
缺少jar包:
- commons-logging-1.1.1.jar(用来打印log)
2.导入以上jar包后tomcat启动,但有报错:
2017-2-21 10:26:09 org.springframework.web.servlet.FrameworkServlet initServletBean
严重: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [springmvc.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource
spring框架初始化context出错,缺少解析xml的类org/springframework/aop/TargetSource,
依然是缺少jar包spring-aop
导入两个缺少的jar包后终于正常启动了,然后访问url “http://localhost:8066/SpringMVC/helloworld”成功进入controller断点,并返回预期页面。下面来研究下spring-aop
AOP(Aspect Oriented Programming),即面向切面编程,可以说是OOP(Object Oriented Programming,面向对象编程)的补充和完善。