一、异常描述
关于java通过ojdbc连接oracle数据库读取大文本字段readTemCLOB报"java.io.IOException: 类型长度大于最大值..oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716)java.io.BufferedReader.readLine(BufferedReader.java:382)"错误异常,详情日志如下>>
java.io.IOException: 类型长度大于最大值@b@ at oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716)@b@ at oracle.jdbc.driver.OracleClobReader.needChars(OracleClobReader.java:222)@b@ at oracle.jdbc.driver.OracleClobReader.read(OracleClobReader.java:163)@b@ at java.io.BufferedReader.fill(BufferedReader.java:154)@b@ at java.io.BufferedReader.readLine(BufferedReader.java:317)@b@ at java.io.BufferedReader.readLine(BufferedReader.java:382)@b@ at com.xwood.pms.dao.impl.CommonDao.readTemCLOB(CommonDao.java:352)@b@ at com.xwood.pms.dao.impl.TempletDao.viewCODE_BODY(TempletDao.java:245)@b@ at com.xwood.pms.dao.impl.TempletDao$$FastClassByCGLIB$$baffc973.invoke(<generated>)@b@ at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)@b@ at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)@b@ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)@b@ at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)@b@ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@ at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)@b@ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@ at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)@b@ at com.xwood.pms.dao.impl.TempletDao$$EnhancerByCGLIB$$8cc9a28c.viewCODE_BODY(<generated>)@b@ at com.xwood.pms.service.impl.TempletServer.viewCODE_BODY(TempletServer.java:89)@b@ at com.xwood.pms.web.action.TempletAction.viewCODE_BODY(TempletAction.java:280)@b@ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)@b@ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)@b@ at java.lang.reflect.Method.invoke(Method.java:606)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)@b@ at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)@b@ at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)@b@ at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)@b@ at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)@b@ at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)@b@ at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)@b@ at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)@b@ at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)@b@ at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)@b@ at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)@b@ at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)@b@ at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)@b@ at com.xwood.pms.util.LoginFilter.doFilter(LoginFilter.java:46)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)@b@ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)@b@ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)@b@ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)@b@ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)@b@ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)@b@ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)@b@ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)@b@ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)@b@ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)@b@ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)@b@ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1720)@b@ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)@b@ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)@b@ at java.lang.Thread.run(Thread.java:745)
二、解决方法
1. 问题分析 - 因之前代码使用ojdbc14.jar版本连接oracle 10g 32位版本,现在数据迁移到64位oracle11g环境
2. 根据Oracle 对应的OJDBC驱动 版本对照表
Oracle 版本 | jdk版本 | 推荐jar包 | 备注 |
Oracle 8i | JDK 1.1.x | classes111.zip | |
Oracle 8i | JDK 1.1.x | classes12.zip | 这个版本是有classes12.jar的,可以尝试下载 |
Oracle 9i | JDK 1.1.x | classes111.jar 或者 classes111.zip | |
Oracle 9i | JDK 1.2 and JDK 1.3 | classes12.jar 或者 classes12.zip | |
Oracle 9i | JDK 1.4 | ojdbc14.jar | |
Oracle 9i | JDK 1.5 | ojdbc5.jar | 这个jar包我不确定网上有 |
Oracle 9i | JDK 1.6 | ojdbc6.jar | |
Oracle 10g | JDK 1.2 and JDK 1.3. | classes12.jar | |
Oracle 10g | JDK 1.4 and 5.0 | ojdbc14.jar | |
Oracle 11g | jdk5 | ojdbc5.jar | |
Oracle 11g | jdk6 | ojdbc6.jar |
3. 参照2 需要改为ojdbc6.jar驱动使用