idea 创建多个线程并通过mybatis 去批量插入数据库,一直报回滚错误,错误如下 5C

```Exception in thread "pool-4-thread-4" org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: One or more resources refused to commit (possibly because of a timeout in the resource - see the log for details). This transaction has been rolled back instead.
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1037)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:532)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:304)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.cloudyoung.springboot.project.standard.mvc.serviceImpl.associator.AssociatorIntegralImportServiceImpl$$EnhancerBySpringCGLIB$$70d5b82.resetIntegualByPage()
at com.cloudyoung.springboot.project.standard.mvc.serviceImpl.associator.AssociatorIntegralImportServiceImpl$1.run(AssociatorIntegralImportServiceImpl.java:205)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.transaction.RollbackException: One or more resources refused to commit (possibly because of a timeout in the resource - see the log for details). This transaction has been rolled back instead.
at com.atomikos.icatch.jta.TransactionImp.rethrowAsJtaRollbackException(TransactionImp.java:48)
at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:188)
at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:414)
at com.atomikos.icatch.jta.UserTransactionManager.commit(UserTransactionManager.java:159)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1034)
... 12 more


但是 我根据所报错误 在配置文件下加了以下配置

com.tomikos.atomikosDataSource.MaxPoolSize=3000
com.tomikos.atomikosDataSourc.PoolSize=100
com.tomikos.atomikosDataSource.BorrowConnectionTimeout=100
com.tomikos.icatch.default_jta_timeout=200000

但是还是报错,为什么,有哪位大佬帮忙回答一下呢
csdn_kaigezhou
目与木鱼 不要使用公共的数据库连接,在每个线程里创建自己的sqlsession连接
6 个月之前 回复

1个回答

allowMultiQueries=true 这个放在jdbc url里,表示支持批处理

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐