在使用Atomikos过程中遇到的一些问题,以作记录:

MySQL does not support TMJOIN

MySQL does not allow for joining an existing XA transaction branch, as mentioned here:http://dev.mysql.com/doc/refman/5.0/en/xa-restrictions.html - the consequence is that one transaction accessing the same MySQL multiple times can run into problems like this:

com.atomikos.datasource.ResourceException: resume for XID 192.168.162.50.tm0000100012192.168.162..tm1 raised -: invalid arguments were given for the XA operation
at com.atomikos.datasource.xa.XAResourceTransaction.resume(Unknown Source)
at com.atomikos.jdbc.ConnectionProxy.invoke(Unknown Source)
at $Proxy8.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:)
at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:)
[...]

A possible workaround might be to try and start TransactionsEssentials with the parametercom.atomikos.icatch.serial_jta_transactions set to false.

com.atomikos.icatch.serial_jta_transactions=false

Also, make sure to set the following property on the MySQL datasource:

 pinGlobalTxToPhysicalConnection="true"  

  以上是Atomikos官方关于Mysql bug的一些说明,解决这个问题按照官方说明,我们可以在jta.properties或者transactions.properties里面添加com.atomikos.icatch.serial_jta_transactions=false这么一段,可能我姿势不正确,没起作用。第二种方法是在Mysql的XADataSource的pinGlobalTxToPhysicalConnection设置为true,这可难办了,我使用的是druid的数据源,好像没有pinGlobalTxToPhysicalConnection这个的属性吧?苦恼了一段时间,查了一些资料都没有发现解决办法,突然灵机一动,试一下在url后缀加上这段东西,没想到真行了。

jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&pinGlobalTxToPhysicalConnection=true

MyBatis不能回滚事务?

2016-10-24 11:07:04,458 INFO  [com.atomikos.datasource.xa.XAResourceTransaction] - XAResource.end ( 31302E3232382E37352E3132352E746D30303030313030303134:31302E3232382E37352E3132352E746D31 , XAResource.TMSUCCESS ) on resource apikore represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@12a8ee2
2016-10-24 11:07:04,462 INFO [com.atomikos.datasource.xa.XAResourceTransaction] - XAResource.rollback ( 31302E3232382E37352E3132352E746D30303030313030303134:31302E3232382E37352E3132352E746D31 ) on resource apikore represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@12a8ee2
2016-10-24 11:07:04,466 INFO [com.atomikos.icatch.imp.CompositeTransactionImp] - rollback() done of transaction 127.0.0.1.tm0000100014

  检查一下控制台是否有着段输出,如果有,那么应该是回滚成功的。如果你断点spring的TransactionManager确定事务应经启用的情况下,出错了却没有回滚,请检查一下,事务设置是否带有rollback-for="Exception"

 <tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/> 

Connection pool exhausted - try increasing 'maxPoolSize'

错误:

[ERROR][-- ::,][org.hibernate.engine.jdbc.spi.SqlExceptionHelper]Connection pool exhausted - try increasing 'maxPoolSize' and/or 'borrowConnectionTimeout' on the DataSourceBean.
[ERROR][-- ::,][org.apache.struts2.dispatcher.Dispatcher]Exception occurred during processing request: Could not open connection

在AtomikosDataSourceBean配置添加如下代码:

 <property name="minPoolSize" value="5" />
<property name="maxPoolSize" value="20" />
<property name="borrowConnectionTimeout" value="60" />

Error in recovery

错误:

[ERROR][-- ::,][com.atomikos.recovery.imp.CachedRepository]Corrupted log file - restart JVM
com.atomikos.recovery.LogReadException: java.lang.ArrayIndexOutOfBoundsException:
at com.atomikos.recovery.imp.FileSystemRepository.getAllCoordinatorLogEntries(FileSystemRepository.java:)
at com.atomikos.recovery.imp.CachedRepository.init(CachedRepository.java:)
at com.atomikos.icatch.provider.imp.AssemblerImp.createCoordinatorLogEntryRepository(AssemblerImp.java:)
at com.atomikos.icatch.provider.imp.AssemblerImp.assembleTransactionService(AssemblerImp.java:)
at com.atomikos.icatch.config.Configuration.assembleSystemComponents(Configuration.java:)
at com.atomikos.icatch.config.Configuration.init(Configuration.java:)
at com.atomikos.icatch.jta.UserTransactionManager.startupTransactionService(UserTransactionManager.java:)
at com.atomikos.icatch.jta.UserTransactionManager.initializeTransactionManagerSingleton(UserTransactionManager.java:)
at com.atomikos.icatch.jta.UserTransactionManager.checkSetup(UserTransactionManager.java:)
at com.atomikos.icatch.jta.UserTransactionManager.init(UserTransactionManager.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
atomikos版本升级到4.0.4解决。

  后续若有发现问题,再行添加。

Atomikos的使用过程中要注意的事的更多相关文章

  1. WINDOWS系统下MYSQL安装过程中的注意事项

    1.首先MySQL的安装方式有两种:一种是MSI安装方式,很简单就像安装Windows软件一样.另外一种就是ZIP安装方式.这种相对而言比较麻烦.新手推荐MSI安装方式. 安装方式有以下两种: MSI ...

  2. 【转】SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误

    SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误 最近在VS2013上连接远程数据库时,突然连接不上,在跑MSTest下跑的时候,QTAgent32 crash.换成IIS ...

  3. zabbix 3.0.3 (nginx)安装过程中的问题排错记录

    特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3 1.Error ...

  4. C语言调试过程中duplicate symbol错误分析

    说明:在我们调试C语言的过程中,经常会遇到duplicate symbol错误(在Mac平台下利用Xcode集成开发环境).如下图: 一.简单分析一下C语言程序的开发步骤. 由上图我们可以看出C语言由 ...

  5. 测试或运维工作过程中最常用的几个linux命令?

     大家在测试工作过程中,可能会遇到需要你去服务器修改一些配置文件,譬如说某个字段的值是1 则关联老版本,是0则关联新版本,这时候你可能就需要会下vi的命令操作:或者查看session设置的时长,可能需 ...

  6. MySQL Fabric和MyBatis的整合过程中遇到的问题

    这是我昨天在整合MySQL Fabric和MyBatis时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...

  7. gulp使用过程中出现的问题

    在使用gulp的过程中,最容易出现错误的地方就是在安装本地的gulp的时候,错误的原因有: 1.本来是局部安装gulp,但使用命令时还带-g. 2.忘记在局部安装gulp. 以上两种情况出错时会报错, ...

  8. JAVA安装过程中出现的“javac不是内部或外部指令”的解决方法

    近来重新安装了JAVA,安装过程中出现问题,网上找到解决办法,汇总发布. 解决流程: 1.确定自己的环境变量设置没问题,没有出现遗漏 : . 等情况 (具体环境变量设置百度) 2.环境变量设置后 ,d ...

  9. Android编译过程中的碎碎念

    刷机不是用rom包吗?怎么可以使用fastboot flashall -w将*.img文件刷入呢? 在Mac上面可以参考这篇文章进行刷机.概括来说解释从官方下载rom包,解压后运行./flash-al ...

随机推荐

  1. mysql技术点1.-----------查询当天的所有数据

    select xs.* from xn_supervision xs where  xs.task_type="+taskType+"  and  xs.create_time&g ...

  2. 初识Spring框架实现IOC和DI(依赖注入)

    学习过Spring框架的人一定都会听过Spring的IoC(控制反转) .DI(依赖注入)这两个概念,对于初学Spring的人来说,总觉得IoC .DI这两个概念是模糊不清的,是很难理解的, IoC是 ...

  3. Eclipse安装Spring-tool-suite

    目录结构: // contents structure [-] 在Eclipse上安装Spring-tool-suite的方法有那些 如何查看自己的Eclipse版本 如何知道自己的Eclipse对应 ...

  4. jQuery全选、全不选、反选

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script sr ...

  5. 用 Excel 测试“绘制两点间连线”的算法

    最近在研究和制作数字示波器,其中涉及一个小算法:需要将 ADC 采样的数值在 TFT LCD 屏幕上面显示并且用“线”连接起来. ADC 按照时序对输入电压采样后,记录的是一个个的数值,如果显示的时候 ...

  6. swift-字典

    swift字典 在swift中,key:key值一定是可hash的,一定是独一无二的,swift的基本数据类型(String,Int,Float)都是可哈希的,所以都可以作为key值. value:没 ...

  7. Scala变量(三)

    变量是一种使用方便的占位符,用于引用计算机内存地址,变量创建后会占用一定的内存空间. 基于变量的数据类型,操作系统会进行内存分配并且决定什么将被储存在保留内存中.因此,通过给变量分配不同的数据类型,你 ...

  8. [转]ubuntu linux下DNS重启后丢失

    从网上得知 /etc/resolv.conf中的DNS配置是从/etc/resolvconf/resolv.conf.d/head中加载而来,所以每回改resolv.conf都会失效,在此文件里面已经 ...

  9. Python测试函数的方法之一

    Python测试函数的方法之一 首先介绍简单的try......except尝试运行的放例如下面的图和代码来简单介绍下: 注释:提醒以下代码环境为2.7.x 请3.x以上的同学们老规矩print(把打 ...

  10. android onNewIntent调用时机

    (转自:http://www.cnblogs.com/zenfly/archive/2012/02/10/2345196.html) 在IntentActivity中重写下列方法:onCreate o ...