【问题标题】:myBatis unable to openSession, selenium integration and myBatismyBatis 无法 openSession,selenium 与 myBatis 集成
【发布时间】:2013-11-10 17:08:08
【问题描述】:

这是@beforeTest 方法的示例代码:

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在下面的代码中使用的是哪种Connection:

SqlSession session = sqlSessionFactory.openSession(Connection con);

【问题讨论】:

    标签: java testing selenium integration mybatis


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多