徐小涛_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里,表示支持批处理

    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏