메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


* 참고1 ==> http://kshmc.tistory.com/entry/MyBatis-Datasource-%EC%B0%B8%EA%B3%A0
* 참고2 ==> http://fruitdev.tistory.com/59

mybatis을 이용한 java프로그램에서 주말(토,일)에 아래와 같은 오류가 발생하는 경우가 있는데 이는 커넥션이 끊어진 상태에서 query를 보내려할때 발생한다. 이때는 mybatis에서 아래와 같은 설정 하여준다. 특히 아래의 두개 값이 설정되어야 주기적으로 커넥션을 체크하여 커넥션을 유지 할 수 있다.

poolPingEnabled : 커넥션이 살아있는지 ping 테스트 여부
poolPingQuery : 커넥션 ping 테스트 쿼리 (DB 종류에 따라 적절하게 수정)

--------설정부분--------------------------------
<environments default="development">
    <environment id="development">
        <transactionManager type="JDBC" />
        <dataSource type="POOLED">
            <property name="driver" value="${driver}" />
            <property name="url" value="${url}" />
            <property name="username" value="${username}" />
            <property name="password" value="${password}" />
            <property name="poolMaximumActiveConnections" value="20"/>
            <property name="poolMaximumIdleConnections" value="20"/>
            <property name="poolMaximumCheckoutTime" value="20000"/>
            <property name="poolPingEnabled" value="true"/>
            <property name="poolPingQuery" value="select 1"/>
            <property name="poolPingConnectionsNotUsedFor" value="10000"/>
            <property name="poolTimeToWait" value="15000"/>
        </dataSource>
    </environment>
</environments>

------------------------------오류내용-----------------------------------
[2016-10-31 10:47:30,879] [util.Utils] [runShell(#581)] [DEBUG] Thread errMsgT Status : TERMINATED 
[2016-10-31 10:47:30,879] [util.Utils] [runShell(#586)] [DEBUG] notTimeOver ==========================>true 
[2016-10-31 10:47:30,879] [util.Utils] [runShell(#601)] [DEBUG] process destoryed ==========================> 
[2016-10-31 10:47:30,879] [sf.TripleService] [sendTripleFile(#247)] [DEBUG] resultStr in TripleService.sendTripleFile() == > [, ] 
[2016-10-31 10:47:30,879] [sf.TripleService] [sendTripleFile(#258)] [INFO] sendTripleFile end==========================> 
[2016-10-31 10:47:30,879] [onem2m.AvroOneM2MDataSubscribe] [sendTriples(#224)] [INFO] Sending triples in com.gooper.icbms.sda.kafka.onem2m.AvroOneM2MDataSubscribe end....................... 
[2016-10-31 10:47:30,879] [comm.SchComm] [updateFinishTime(#69)] [DEBUG] updateFinishTime in SchComm start..... 
[2016-10-31 10:47:30,879] [service.Sch2ServiceImpl] [updateFinishTime(#143)] [DEBUG] updateFinishTime() ......................... start  
org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)
        at com.gooper.icbms.sda.comm.sch.dao.Sch2DAO.updateFinishTime(Sch2DAO.java:33)
        at com.gooper.icbms.sda.comm.service.Sch2ServiceImpl.updateFinishTime(Sch2ServiceImpl.java:144)
        at com.gooper.icbms.sda.comm.SchComm.updateFinishTime(SchComm.java:93)
        at com.gooper.icbms.sda.kafka.onem2m.AvroOneM2MDataSubscribe$1.run(AvroOneM2MDataSubscribe.java:162)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
        at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:102)
        at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:135)
        at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:58)
        at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:271)
        at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:44)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
        ... 7 more
Caused by: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
        at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:123)
        at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69)
        at org.mariadb.jdbc.MariaDbStatement.executeQueryEpilog(MariaDbStatement.java:261)
        at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:290)
        at org.mariadb.jdbc.MariaDbStatement.executeUpdate(MariaDbStatement.java:474)
        at org.mariadb.jdbc.MariaDbStatement.executeUpdate(MariaDbStatement.java:490)
        at org.mariadb.jdbc.MariaDbConnection.setAutoCommit(MariaDbConnection.java:492)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.ibatis.datasource.pooled.PooledConnection.invoke(PooledConnection.java:245)
        at com.sun.proxy.$Proxy5.setAutoCommit(Unknown Source)
        at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:97)
        ... 15 more
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:472)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.result(AbstractQueryProtocol.java:401)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:383)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:339)
        at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:280)
        ... 24 more
Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4
        at org.mariadb.jdbc.internal.util.buffer.ReadUtil.readFully(ReadUtil.java:78)
        at org.mariadb.jdbc.internal.packet.read.RawPacket.nextPacket(RawPacket.java:112)
        at org.mariadb.jdbc.internal.packet.read.ReadPacketFetcher.getReusableRawPacket(ReadPacketFetcher.java:143)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:417)
        ... 28 more
[2016-10-31 10:47:30,880] [service.Sch2ServiceImpl] [updateFinishTime(#154)] [DEBUG] Exception in updateFinishTime()=====> 
### Error updating database.  Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 
[2016-10-31 10:47:30,881] [onem2m.AvroOneM2MDataSubscribe$1] [run(#171)] [DEBUG] consumer(com.gooper.icbms.sda.kafka.onem2m.AvroOneM2MDataSubscribe$1) exception : org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 

번호 제목 글쓴이 날짜 조회 수
» Caused by: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 오류시 확인/조치할 내용 총관리자 2016.10.31 3779
300 VisualVM 1.3.9을 이용한 spark-submit JVM 모니터링을 위한 설정및 spark-submit실행 옵션 총관리자 2016.10.28 1891
299 VisualVM 1.3.9을 이용한 JVM 모니터링 file 총관리자 2016.10.27 332
298 운영중인 상태에서 kafka topic삭제하고 재생성하여 처리되지 않은 메세지 모두 삭제하기 총관리자 2016.10.24 156
297 producer / consumer구현시 설정 옵션 설명 총관리자 2016.10.19 121
296 java.lang.OutOfMemoryError: unable to create new native thread오류 발생지 조치사항 총관리자 2016.10.17 469
295 동시에 많은 요청이 endpoint로 몰려서java.net.NoRouteToHostException가 발생하는 경우의 처리방법 총관리자 2016.10.17 509
294 AIX 7.1에 Python 2.7.11설치하기 총관리자 2016.10.06 651
293 프로그래밍 언어별 딥러닝 라이브러리 정리 file 총관리자 2016.10.05 215
292 모두를 위한 머신러닝과 딥러닝의 강의 file 총관리자 2016.09.27 192
291 DBCP Datasource(org.apache.commons.dbcp.BasicDataSource) 설정 및 속성 설명 총관리자 2016.09.26 74
290 AIX 7.1에서 hive실행시 "hive: line 86: readlink: command not found" 오류가 발생시 임시 조치사항 총관리자 2016.09.25 234
289 hive기동시 Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D 오류 발생시 조치사항 총관리자 2016.09.25 496
288 schema설정없이 hive를 최초에 실행했을때 발생하는 오류메세지및 처리방법 총관리자 2016.09.25 1226
287 파일끝에 붙는 ^M 일괄 지우기(linux, unix(AIX)) 혹은 파일내에 있는 ^M지우기 총관리자 2016.09.24 78
286 AIX 7.1에 MariaDB 10.2 소스 설치 총관리자 2016.09.24 2367
285 ./hadoop-daemon.sh start namenode로 namenode기동시 EditLog의 custerId, namespaceId가 달라서 발생하는 오류 해결방법 총관리자 2016.09.24 119
284 hadoop 어플리케이션을 사용하는 사용자 변경시 바꿔줘야 하는 부분 총관리자 2016.09.23 68
283 format된 namenode를 다른 서버에서 다시 format했을때 오류내용 총관리자 2016.09.22 155
282 journalnode노드 기동시 "should be an absolute path"가 발생하고 기동되지 않을 경우 확인사항 총관리자 2016.09.22 93

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로