徐小涛_nice 2018-10-17 11:50 采纳率: 0%
浏览 4201
已结题

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

```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

但是还是报错,为什么,有哪位大佬帮忙回答一下呢
  • 写回答

1条回答

  • qyg_java 2018-10-25 06:46
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法