2013-10-30 4 views
0
에 MyBatis로없는

여기 @beforeTest 방법에 대한 예제 코드는 다음과 같습니다OpenSession에, 셀레늄 통합 및 MyBatis로

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

내가 연결을 사용하기를 원하지만 아래의 코드에서 사용하는 연결 MyBatis로 어떤 종류의 확실하지 :

SqlSession session = sqlSessionFactory.openSession(Connection con); 

답변

0

openSession 메서드는 java.sql.Connection의 인스턴스를 필요로합니다. this tutorial이 도움이 될 수 있습니다.