首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >myBatis无法openSession、selenium集成和myBatis

myBatis无法openSession、selenium集成和myBatis
EN

Stack Overflow用户
提问于 2013-10-31 05:12:48
回答 1查看 1.2K关注 0票数 0

下面是@beforeTest方法的示例代码:

代码语言:javascript
复制
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new ( SqlSessionFactoryBuilder().build(inputStream);
SqlSession session = sqlSessionFactory.openSession();  
here couldnot open the  connection    

and the output testing under testNG is:
FAILED CONFIGURATION: @BeforeTest setupPermission
org.apache.ibatis.exceptions.PersistenceException:  
Error opening session.  Cause: java.lang.NullPointerException  
Cause: java.lang.NullPointerException  
------------------------------------------------------  

我想使用Connection,但不确定myBatis在下面的代码中使用的是哪种连接:

代码语言:javascript
复制
SqlSession session = sqlSessionFactory.openSession(Connection con);
EN

回答 1

Stack Overflow用户

发布于 2013-11-04 19:57:25

openSession方法需要java.sql.Connection的实例。您可能会发现this tutorial很有帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19693898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档