Mybatis学习(一)环境搭建之踩坑

第一次报错:

DEBUG 2017-03-30 01:37:40,043 org.apache.ibatis.logging.LogFactory: Logging init
ialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
org.apache.ibatis.exceptions.PersistenceException: 
### Error opening session.  Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory
.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromD
ataSource(DefaultSqlSessionFactory.java:100)
	at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(Defa
ultSqlSessionFactory.java:47)
	at com.learn.chapter2.util.SqlSessionFactoryUtil.openSqlSession(SqlSessionFacto
ryUtil.java:47)
	at com.learn.chapter2.main.Chapter2Main.main(Chapter2Main.java:14)
Caused by: java.lang.NullPointerException
	at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromD
ataSource(DefaultSqlSessionFactory.java:95)
	... 3 more

mybatis-config.xml配置有误,将default值development写成了delelopment。


第二次报错:

DEBUG 2017-04-02 21:47:00,718 org.apache.ibatis.logging.LogFactory: Logging init
ialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
DEBUG 2017-04-02 21:47:00,791 org.apache.ibatis.datasource.pooled.PooledDataSour
ce: PooledDataSource forcefully closed/removed all connections.
DEBUG 2017-04-02 21:47:00,793 org.apache.ibatis.datasource.pooled.PooledDataSour
ce: PooledDataSource forcefully closed/removed all connections.
DEBUG 2017-04-02 21:47:00,793 org.apache.ibatis.datasource.pooled.PooledDataSour
ce: PooledDataSource forcefully closed/removed all connections.
DEBUG 2017-04-02 21:47:00,793 org.apache.ibatis.datasource.pooled.PooledDataSour
ce: PooledDataSource forcefully closed/removed all connections.
ex: Type interface com.learn.chapter2.mapper.RoleMappler is not known to the Map
perRegistry.



Mapper的原因。


第三次报错:

Cause: java.lang.ClassNotFoundException: Cannot find cla ss: com.mysql.jdbc.Driver

加包即可。






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值