我在搭建mybatis时碰到的一系列问题

问题总结:
1.Error while performing database login with the XXXdriver; Listener refused the connection with the following error; ORA-12505,TNS:listener does not currently know of SID given inconnect descrip
是配置的数据库sid名不正确,sid一般是自己数据库名字
解决办法

https://blog.csdn.net/zoro_13/article/details/16939523

2.Referenced file contains errors(file:/D:/config/ mybatis-3-mapper.dtd).
dtd位置不对
解决方法:
配置

 <?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"> 

将 “http://mybatis.org/dtd/mybatis-3-config.dtd“>
修改为
http://www.mybatis.org/dtd/mybatis-3-config.dtd“>

解决办法

https://blog.csdn.net/dear_alice_moon/article/details/73208116

3.
mybatis Mapping xml报

The content of element type "mapper" must match "EMPTY". Children of type "comment" are not allowed."

解决方法:因为定义实体映射xml文件的文档类型里面的属性不对的缘故。

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

改成

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Configuration 3.0//EN" "mybatis-3-mapper.dtd" >
https://blog.csdn.net/u010201338/article/details/78577708

4.
1)Type interface com.vmpjin.dao.PersonMapper is not known to the MapperRegistry.
我的Mapper.xml文件中namespace与mybatis.xml中的Mapper中配置的映射文件不一致,导致了这个问题的发生
解决办法:

https://blog.csdn.net/vmp_jin/article/details/50765034

2)Type interface com.mapper.EmployeeMapper is already known to the MapperRegistry
解决办法

https://blog.csdn.net/kingscoming/article/details/78857974

5.The Network Adapter could not establish the connection
原因:是我配置的是本地的Oracle,而我本地没有Oracle数据库。我本意是想连公司的远程测试数据库
mybatis-config.xml中

    <!-- 数据库连接池 -->
            <dataSource type="POOLED">
                <property name="driver" value="oracle.jdbc.driver.OracleDriver" />
                <property name="url" value="jdbc:oracle:thin:@xxx.xxx.xxx:数据库名" />

            </dataSource>

猜你喜欢

转载自blog.csdn.net/sinat_35803474/article/details/82626572
今日推荐