-
剪不断,理还乱,是BUG
- 相遇:不允许有匹配 "[xX][mM][lL]" 的处理指令目标
在编写MyBatic框架时,纯手编写mybatic-config.xml文件,遇见了你
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
at f.b.y.test.H.main(H.java:21)
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:259)
at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:125)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:82)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77)
... 2 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(XMLScanner.java:723)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(XMLDocumentFragmentScannerImpl.java:1018)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(XMLScanner.java:691)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:912)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:257)
... 5 more
-
眼里寻它千百次,蓦然回首它却在开头处
- 相知:XML文件的第一个元素且前面不能空格
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!-- configuration构建MyBatic上下文 -->
<configuration>
<typeAliases>
<typeAlias alias="user" type="f.b.y.pojo.User"/>
</typeAliases>
<!--数据库环境 -->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"></transactionManager>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatisnote"/>
<property name="username" value="root"/>
<property name="password" value="12345678"/>
</dataSource>
</environment>
</environments>
<!-- 映射文件 -->
<mappers>
<mapper resource="f/b/y/pojo/sqlmap/usersql.xml"/>
</mappers>
</configuration>
- 相爱:能不能再靠近一些(去掉前面空格)
<?xml version="1.0" encoding="UTF-8" ?>
-
因为遇见,所以感悟
1、人总是不断的犯错误,面对错误,大多数人的开始选择是找错误,找方法解决它,往往事与愿违。对于错误本身而言,错误就是错误,无论大 小,都是致命的,细心显得十分重要。
2、每一个人都会犯错,可怕的不是错误本身,可怕的是没有勇气去面对、去发现、去解决它。
3、每一个人一路走来不可能一帆风顺,代码运行可能是你正常代码不正常或你不正常代码正常。那些错误将磨砺你的意志、丰富你的阅历,也 许,下次遇到它你会觉得错误是多么亲切可爱,解决错误是多么荣耀的一件事啊!
来源:oschina
链接:https://my.oschina.net/u/4274582/blog/3301601