一、异常描述
通过DBUtilExt工具类进行实现文本大字段读取readTemCLOB的时候,报“java.sql.SQLException: Io 异常: Bad packet type...java.sql.SQLException: Io 异常: Invalid Packet Lenght”异常,详细错误日志如下>>
java.sql.SQLException: Io 异常: Bad packet type@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)@b@ at oracle.jdbc.driver.OracleResultSetImpl.internal_close(OracleResultSetImpl.java:1466)@b@ at oracle.jdbc.driver.OracleResultSetImpl.close(OracleResultSetImpl.java:92)@b@ at com.xwood.engine.common.util.DBUtilExt.readTemCLOB(DBUtilExt.java:104)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.addclob(TinContentMapProcesserHandler.java:37)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.addclob(TinContentMapProcesserHandler.java:28)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.add(TinContentMapProcesserHandler.java:71)@b@ at com.xwood.engine.publisher.core.processunit.S3PEntityRedisProcessUnit.setTargetobj(S3PEntityRedisProcessUnit.java:161)@b@ at com.xwood.engine.publisher.core.processunit.S3PEntityRedisProcessUnit.run(S3PEntityRedisProcessUnit.java:71)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)@b@ at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:138)@b@ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)@b@ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)@b@ at java.lang.Thread.run(Thread.java:662)@b@java.sql.SQLException: Io 异常: Invalid Packet Lenght@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)@b@ at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)@b@ at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:648)@b@ at com.xwood.engine.common.util.DBUtilExt.readTemCLOB(DBUtilExt.java:106)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.addclob(TinContentMapProcesserHandler.java:37)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.addclob(TinContentMapProcesserHandler.java:28)@b@ at com.xwood.engine.publisher.master.TinContentMapProcesserHandler.add(TinContentMapProcesserHandler.java:71)@b@ at com.xwood.engine.publisher.core.processunit.S3PEntityRedisProcessUnit.setTargetobj(S3PEntityRedisProcessUnit.java:161)@b@ at com.xwood.engine.publisher.core.processunit.S3PEntityRedisProcessUnit.run(S3PEntityRedisProcessUnit.java:71)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)@b@ at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:138)@b@ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)@b@ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)@b@ at java.lang.Thread.run(Thread.java:662)
二、解决办法
根据错误日志提示找到抛异常入口代码“rs_clob.close();”、“st.close();”,通过异常捕捉处理解决问题,如下
if(rs_clob!=null)@b@ rs_clob.close();@b@if(st!=null)@b@ st.close();
修改为
try {@b@if(rs_clob!=null)@b@ rs_clob.close();@b@if(st!=null)@b@ st.close();@b@ } catch (Exception e) { }