首页 > 解决方案 > com.ibm.websphere.ce.cm.StaleConnectionException:IO 错误:在 OracleDb 上用 PDF 更新插入记录时连接重置

问题描述

我们有一个由 Spring 3.2.17 提供支持的 Java 后端,它部署在属于客户的 WebSphere Liberty Application Server 中,因此我无权访问它。
我们正在尝试在 Oracle 数据库中创建一条记录,以便插入我们从外部服务下载的 PDF。此信息以 byte[] 的形式返回。
这是我们正在使用的 upsert 查询,通过 MyBatis-Spring

<update id="upsert">
MERGE INTO T_PDF PDF USING dual ON(PDF.CODICE_FISCALE = #{codiceFiscale} AND PDF.ID_PRATICA= #{idPratica})
            WHEN MATCHED THEN
            UPDATE SET
            DATA_UPDATE = SYSDATE
            <if test="nome != null and nome != ''" >
            , NOME = #{nome}
            </if>
            <if test="cognome != null and cognome != ''" >
            , COGNOME = #{cognome}
            </if>
            <if test="owner != null and owner != ''" >
            ,OWNER = #{owner}
            </if>
            <if test="isPrincipale != null and isPrincipale != ''" >
            ,IS_PRINCIPALE = #{isPrincipale}
            </if>
            <if test="isCensito != null and isCensito != ''" >
            , IS_CENSITO = #{isCensito}
            </if>
            <if test="stato!= null and stato != ''" >
            , STATO = #{stato}
            </if>
            <if test="unico != null and unico != ''" >
            , UNICO = #{unico}
            </if>
            <if test="consulenza!= null and consulenza != ''" >
            , CONSULENZA = #{consulenza}
            </if>
            <if test="mifid != null and mifid != ''" >
            , MIFID = #{mifid}
            </if>
            <if test="seiPdf != null and seiPdf != ''" >
            , SEI_PDF = #{seiPdf}
            </if>
            <if test="seiCommAtt != null and seiCommAtt != ''" >
            , SEI_COMM_ATT = #{seiCommAtt}
            </if>
            <if test="seiCommPer != null and seiCommPer != ''" >
            , SEI_COMM_PER = #{seiCommPer}
            </if>
            <if test="seiRicFatt!= null and seiRicFatt != ''" >
            , SEI_RIC_FATT = #{seiRicFatt}
            </if>
            <if test="apertura != null and apertura != ''" >
            , APERTURA = #{apertura}
            </if>
            <if test="miniQav != null and miniQav != ''" >
            , MINI_QAV = #{miniQav }
            </if>
            <if test="sintesi != null and sintesi != ''" >
            , SINTESI = #{sintesi}
            </if>
            <if test="informativo != null and informativo != ''" >
            , INFORMATIVO = #{informativo}
            </if>
            <if test="cambioIndirizzo != null and cambioIndirizzo != ''" >
            , CAMBIO_INDIRIZZO = #{cambioIndirizzo}
            </if>
            <if test="cambioInfo != null and cambioInfo != ''" >
            , CAMBIO_INFO= #{cambioInfo}
            </if>
            <if test="cambioIndirizzoEinfo != null and cambioIndirizzoEinfo != ''" >
            , CAMBIO_INDIRIZZO_E_INFO = #{cambioIndirizzoEinfo}
            </if>
            <if test="qavPb != null and qavPb != ''" >
            , QAV_PB = #{qavPb}
            </if>
            <if test="variazionePrivacy != null and variazionePrivacy != ''" >
            , VARIAZIONE_PRIVACY = #{variazionePrivacy}
            </if>
            <if test="trasferimentoQuote != null and trasferimentoQuote != ''" >
            , TRASFERIMENTO_QUOTE = #{trasferimentoQuote}
            </if>
            <if test="disposizioneMiniQav != null and disposizioneMiniQav != ''" >
            , DISPOSIZIONE_MINIQAV = #{disposizioneMiniQav}
            </if>
            <if test="omnibus != null and omnibus != ''" >
            , OMNIBUS = #{omnibus}
            </if>
            <if test="iniziativaWelcome != null and iniziativaWelcome != ''" >
            , INIZIATIVA_WELCOME = #{iniziativaWelcome}
            </if>
            <if test="firmaADistanza != null and firmaADistanza != '' ">
            , FIRMA_A_DISTANZA = #{firmaADistanza}
            </if>
            <if test="fatca != null and fatca != '' ">
            , FATCA = #{fatca}
            </if>
            <if test="qav != null and qav != '' ">
            , QAV = #{qav}
            </if>
            
           WHERE CODICE_FISCALE = #{codiceFiscale}
               AND ID_PRATICA = #{idPratica}
            WHEN NOT MATCHED THEN
            INSERT(
                OWNER,
                CODICE_FISCALE,
                NOME,
                COGNOME,
                IS_PRINCIPALE,
                IS_CENSITO,
                STATO,
                UNICO,
                CONSULENZA,
                MIFID,
                SEI_PDF,
                SEI_COMM_ATT,
                SEI_COMM_PER,
                SEI_RIC_FATT,
                APERTURA,
                MINI_QAV,
                SINTESI,
                INFORMATIVO,
                CAMBIO_INDIRIZZO,
                CAMBIO_INFO,
                CAMBIO_INDIRIZZO_E_INFO,
                QAV_PB,
                INIZIATIVA_WELCOME,
                ID_PRATICA,
                DATA_UPDATE,
                VARIAZIONE_PRIVACY,
                TRASFERIMENTO_QUOTE,
                DISPOSIZIONE_MINIQAV,
                OMNIBUS,
                STEP_IN,
                FIRMA_A_DISTANZA,
                FATCA,
                QAV
            ) 
            VALUES (
                #{owner},
                #{codiceFiscale},
                #{nome},
                #{cognome},
                #{isPrincipale},
                #{isCensito},
                #{stato},
                #{unico},
                #{consulenza},
                #{mifid},
                #{seiPdf},
                #{seiCommAtt},
                #{seiCommPer},
                #{seiRicFatt},
                #{apertura},
                #{miniQav},
                #{sintesi},
                #{informativo},
                #{cambioIndirizzo},
                #{cambioInfo},
                #{cambioIndirizzoEinfo},
                #{qavPb},
                #{iniziativaWelcome},
                #{idPratica},
                SYSDATE,
                #{variazionePrivacy},
                #{trasferimentoQuote},
                #{disposizioneMiniQav},
                #{omnibus},
                #{stepIn},
                #{firmaADistanza},
                #{fatca},
                #{qav}
            )
</update>

这是我们用于更新插入的片段

private void savePDF(TipoAdempimentoEnum tipoDocumento, byte[] adempimento,
                     String codiceFiscale, String rete,
                     Long idPratica, Long idTrasferimentoFondi, String matricolaPb) {
    Pdf pdf = new Pdf();
    pdf.setCodiceFiscale(codiceFiscale);
    pdf.setRetePB(rete);
    pdf.setOwner(matricolaPb);

    if(tipoDocumento.toString().equalsIgnoreCase("FTC")) {
        log.info("e' stato aggiunto il pdf del FTC");
        pdf.setFatca(adempimento);
    }
    if(tipoDocumento.toString().equalsIgnoreCase("QAV")) {
        log.info("e' stato aggiunto il pdf del QAV");
        pdf.setQav(adempimento);
    }
    if(idPratica != null) {
        log.info("e' stato trovato idPratica valorizzato");
        pdf.setIdPratica(""+idPratica);
        log.info("inizio salvataggio su T_PDF per il pdf di tipo {}", tipoDocumento);
        pdfMapper.upsert(pdf);
    }
    if(idTrasferimentoFondi != null) {
        log.info("e' stato trovato idTrasferimentoFondi valorizzato");
        pdf.setIdPratica(""+idTrasferimentoFondi);
        log.info("inizio salvataggio su T_PDF_TFSA per il pdf di tipo {}", tipoDocumento);
        pdfTFSAMapper.upsert(pdf);
    }

    log.info("fine salvataggio pdf sul database");
}

但是,该操作会引发以下异常

INFO  05-03-2021 21:04:09,0420 [WebContainer : 1] some.package.db.mappers.PdfMapper [T88yjcid6CT2xptDPxYD8Jr][R011031] [WEB] - DAO : upsert - ARGS: [{"codiceFiscale":"BCHCZM45S52L892G","nome":null,"cognome":null,"isPrincipale":null,"isCensito":null,"owner":"R011031","stato":null,"idPratica":"23391","dataUpdate":null,"retePB":"F"}]
ERROR 05-03-2021 21:04:10,0935 [WebContainer : 1] some.package.db.mappers.PdfMapper [T88yjcid6CT2xptDPxYD8Jr][R011031] [WEB] -
### Error updating database.  Cause: com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: MERGE INTO T_PDF PDF USING dual ON(PDF.CODICE_FISCALE = ? AND PDF.ID_PRATICA= ?)  WHEN MATCHED THEN  UPDATE SET DATA_UPDATE = SYSDATE                       ,OWNER = ? , FATCA = ?  WHERE CODICE_FISCALE = ? AND ID_PRATICA = ? WHEN NOT MATCHED THEN  INSERT( OWNER,CODICE_FISCALE, NOME,  COGNOME, IS_PRINCIPALE,               IS_CENSITO,  STATO,  UNICO, CONSULENZA,MIFID, SEI_PDF,SEI_COMM_ATT,               SEI_COMM_PER, SEI_RIC_FATT,  APERTURA, MINI_QAV,SINTESI,               INFORMATIVO,  CAMBIO_INDIRIZZO, CAMBIO_INFO,               CAMBIO_INDIRIZZO_E_INFO,   QAV_PB, INIZIATIVA_WELCOME,               ID_PRATICA,               DATA_UPDATE,  VARIAZIONE_PRIVACY,               TRASFERIMENTO_QUOTE,               DISPOSIZIONE_MINIQAV,               OMNIBUS,               STEP_IN,               FIRMA_A_DISTANZA,               FATCA,               QAV              )               VALUES (               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               SYSDATE,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?     )
### Cause: com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
; SQL []; IO Error: Connection reset; nested exception is com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
org.springframework.dao.DataAccessResourceFailureException:
### Error updating database.  Cause: com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: MERGE INTO T_PDF PDF USING dual ON(PDF.CODICE_FISCALE = ? AND PDF.ID_PRATICA= ?)              WHEN MATCHED THEN              UPDATE SET           DATA_UPDATE = SYSDATE                       ,OWNER = ?                                                                                                                                                                 , FATCA = ?                           WHERE CODICE_FISCALE = ?              AND ID_PRATICA = ?              WHEN NOT MATCHED THEN              INSERT(               OWNER,               CODICE_FISCALE,               NOME,               COGNOME,               IS_PRINCIPALE,               IS_CENSITO,               STATO,               UNICO,               CONSULENZA,               MIFID,               SEI_PDF,               SEI_COMM_ATT,               SEI_COMM_PER,               SEI_RIC_FATT,               APERTURA,               MINI_QAV,               SINTESI,               INFORMATIVO,               CAMBIO_INDIRIZZO,               CAMBIO_INFO,               CAMBIO_INDIRIZZO_E_INFO,               QAV_PB,               INIZIATIVA_WELCOME,               ID_PRATICA,               DATA_UPDATE,               VARIAZIONE_PRIVACY,               TRASFERIMENTO_QUOTE,               DISPOSIZIONE_MINIQAV,               OMNIBUS,               STEP_IN,               FIRMA_A_DISTANZA,               FATCA,               QAV              )               VALUES (               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               SYSDATE,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?     )
### Cause: com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
; SQL []; IO Error: Connection reset; nested exception is com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:253)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
        at com.sun.proxy.$Proxy55.update(Unknown Source)
        at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:251)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:49)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
        at com.sun.proxy.$Proxy76.upsert(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at some.package.logger.AspectLogDaoMapper.logExecutionService(AspectLogDaoMapper.java:70)
        at sun.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
[...]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at some.package.logger.AspectLogFilter.logExecutionService(AspectLogFilter.java:61)
        at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy310.doFilter(Unknown Source)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at some.package.filter.CheckSessionFilter.doFilter(CheckSessionFilter.java:82)
        at sun.reflect.GeneratedMethodAccessor265.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at some.package.logger.AspectLogFilter.logExecutionService(AspectLogFilter.java:61)
        at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy310.doFilter(Unknown Source)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at some.package.filter.ExpiredSessionFilter.doFilter(ExpiredSessionFilter.java:59)
        at sun.reflect.GeneratedMethodAccessor265.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at some.package.logger.AspectLogFilter.logExecutionService(AspectLogFilter.java:61)
        at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy310.doFilter(Unknown Source)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4047)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1016)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: com.ibm.websphere.ce.cm.StaleConnectionException: IO Error: Connection reset
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:86)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:58)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:542)
        at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(GenericDataStoreHelper.java:629)
        at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(GenericDataStoreHelper.java:688)
        at com.ibm.ws.rsadapter.AdapterUtil.mapException(AdapterUtil.java:2267)
        at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(WSJdbcUtil.java:1219)
        at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:653)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
        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)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
        at java.lang.reflect.Method.invoke(Method.java:620)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
        ... 179 more

这是第一次同时插入字节数组(在 DB 中标记为 BLOB)的 upser 实际导致此异常。我搜索了一下,发现大多数建议都与在 WebSphere 的管理面板上做某事有关,但这是我无权访问的东西。此外,即使它抛出异常,记录实际上是在数据库中创建的。
我能做些什么来避免这个错误?是否可能与导致此错误的 SQL 查询有关?

编辑:完整堆栈跟踪https://pastebin.com/UdzTum46

标签: javaspringwebspheremybatis

解决方案


异常的“StaleConnectionException”部分来自 WebSphere,“IO 错误:连接重置”来自 Oracle JDBC 驱动程序,通常表示 Liberty 和 Oracle 之间的连接丢失。这可能是由于长时间运行的查询的网络超时或某些数据库资源(如表或行)上的死锁。要进一步排除故障,您可能会发现使用timedOperations-1.0Liberty 的 JDBC 功能有帮助,如下所述:https ://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae /cwlp_timeop.htmleventLogging-1.0此处描述的功能https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/rwlp_eventlogging.html


推荐阅读