Weblogic 导致的报错java.sql.SQLTimeoutException: ORA-01013: 用户请求取消当前的操作

问题:

今天测试环境突然爆出一个错,如下:

org.springframework.dao.QueryTimeoutException: 
### Error querying database.  Cause: java.sql.SQLTimeoutException: ORA-01013: 用户请求取消当前的操作

### The error may exist in class path resource [mapper/custom/RespDataIntegrationMapperCustom.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select count(*) from RESP_DATA_INTEGRATION where CREATE_TIME >=  to_date(?,'yyyy-mm-dd hh24:mi:ss') and  CREATE_TIME <   to_date(?, 'yyyy-mm-dd hh24:mi:ss')
### Cause: java.sql.SQLTimeoutException: ORA-01013: 用户请求取消当前的操作

; ORA-01013: 用户请求取消当前的操作
; nested exception is java.sql.SQLTimeoutException: ORA-01013: 用户请求取消当前的操作

   at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:76)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
   at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
   at com.sun.proxy.$Proxy203.selectOne(Unknown Source)
   at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
   at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:83)
   at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
   at com.sun.proxy.$Proxy241.findDataIntegrationCountByTime(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:73)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
   at com.sun.proxy.$Proxy242.findDataIntegrationCountByTime(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:73)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
   at com.sun.proxy.$Proxy242.findDataIntegrationCountByTime(Unknown Source)
   at com.sinosoft.messageweb.web.service.impl.RespDataIntegrationServiceImpl.findDataIntegrationCountByTime(RespDataIntegrationServiceImpl.java:70)
   at com.sinosoft.messageweb.web.service.impl.RespDataIntegrationServiceImpl$$FastClassBySpringCGLIB$$26183e75.invoke(<generated>)
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:752)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
   at com.sinosoft.messageweb.web.service.impl.RespDataIntegrationServiceImpl$$EnhancerBySpringCGLIB$$e0f5b2ce.findDataIntegrationCountByTime(<generated>)
   at com.sinosoft.messageweb.web.service.impl.RespDataIntegrationServiceImpl$$FastClassBySpringCGLIB$$26183e75.invoke(<generated>)
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:752)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
   at com.sinosoft.messageweb.web.service.impl.RespDataIntegrationServiceImpl$$EnhancerBySpringCGLIB$$23d9c55a.findDataIntegrationCountByTime(<generated>)
   at com.sinosoft.messageweb.web.quartztask.SynchronousData.execute(SynchronousData.java:233)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.sql.SQLTimeoutException: ORA-01013: 用户请求取消当前的操作

   at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
   at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
   at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
   at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
   at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
   at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
   at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:747)
   at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:904)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1082)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
   at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
   at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3887)
   at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1079)
   at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:119)
   at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
   at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
   at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
   at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
   at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
   at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:143)
   at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
   at com.sun.proxy.$Proxy278.query(Unknown Source)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
   at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
   ... 49 common frames omitted
Caused by: oracle.jdbc.OracleDatabaseException: ORA-01013: 用户请求取消当前的操作

分析下原因

  • 1.数据库锁
    网上搜了一下,有的说是锁的原因,所以开始以为是锁的原因,但是通过查询数据库锁表发现没有数据,所以,报错应该不是因为这个原因。

    查看哪个表被锁

    select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;
    
  • 2.mybatis设置default-statement-timeout时间过短
    然后看了下代码,发现我们项目根本没有配置mybatis的连接超时时间,通过看源码发现,没有设置超时时间默认应该为null.
    mybatis源码

  • 3.weblogic配置问题
    在weblogic服务中有个JTA配置,默认配置为30s,将其改为超过数据库的执行时间即可
    在这里插入图片描述

解决方法

最后通过分析,修改了weblogic的配置解决问题

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值