第一次报错:
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
加包即可。