mybatis 报ExecutorException: Executor was closed.

kenny277 发布于 2016/11/20 16:29
阅读 1K+
收藏 0
在同一个方法里面,有两步update数据库操作,分别是库中的两张表,但这两步是一个完整事务,第一步update成功了,第二步就报了这个错误
请高手帮忙看下,可能是什么原因?
报错如下:
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  C
ause: org.apache.ibatis.executor.ExecutorException: Executor was closed.
### The error may exist in file [/export/App/transfer.support.ws.aa.com/WEB-INF/classes/mapper/order/Order.xml]
### The error may involve com.aa.bb.ts.support.server.dao.mapper.OrderMapper.updateOrderById
### The error occurred while executing an update
### Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.aa.bb.common.db.mybaties.SqlSessionInterceptor.doInvoke(SqlSessionInterceptor.java:204)
    at com.aa.bb.common.db.mybaties.SqlSessionInterceptor.invoke(SqlSessionInterceptor.java:173)
    at $Proxy39.update(Unknown Source)
    at com.aa.bb.common.db.mybaties.SqlSessionTemplate.update(SqlSessionTemplate.java:147)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)
    at $Proxy42.updateOrderById(Unknown Source)
    at com.aa.bb.ts.support.server.core.service.impl.OrderAndDetailServiceImpl.updateOrderById(OrderAndDetailServiceImpl.java:134)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
    at $Proxy45.updateOrderById(Unknown Source)
    at com.aa.bb.ts.support.server.core.service.impl.AntiAndOrderServiceImpl.cancelAntiAndOrderById(AntiAndOrderServiceImpl.java:131)
    ... 39 more
Caused by: org.apache.ibatis.executor.ExecutorException: Executor was closed.
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:106)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
    ... 59 more
加载中
0
温安适
温安适
提示的是 Executor已经被关闭,能发下调用方式吗?由于mybatis都是从mapper加载sql交由内部executor执行,默认的SimpleExecutor,批处理需要使用如下配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <setting name="defaultExecutorType" value="BATCH" />
    </settings>
</configuration>



返回顶部
顶部