一、问题清单:
1.org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
2.通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明。
3.java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.properties]
4. org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 58; 文档根元素 "mapper" 必须匹配 DOCTYPE 根 "null"。
二、详情和解决如下:
1.org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from URL [file:/D:/00SoftwareInstallPacakge/tomcats/apache-tomcat-7.0.69-windows-x64/apache-tomcat-7.0.69/lib/] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
解决:
新建一个spring配置文件(开启mvc注解和默认handler),并将标注处更改为如下图所示
2.通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明。
解决:补上了红色标注处
3.java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.properties]
原因:找不到资源文件,
解决:在引用配置文件和属性文件的地方都加上classpath:
①applicationContext.xml
<import resource="classpath:appContext_dataSource.xml"/>
②appContext_dataSource.xml
<context:property-placeholder location="classpath:jdbc.properties"/>
4. org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 58; 文档根元素 "mapper" 必须匹配 DOCTYPE 根 "null"。
在UserMapper.xml文件中加上
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">