com.atomikos.icatch.SysException: Error in init():Error during checkpointing
因为我的项目是springboot+maven多模块开发的项目,引用了atomikos 。
最后在部署的时候我把子模块部署到服务器上面,启动第一个子模块的时候没有什么错误。
然后接着启动第二个子项目的时候就报错了。
Can't overwrite cause with com.atomikos.icatch.SysException:Error in init: Error during checkpointing
然后根据问题可以看出来,文件被上锁了。
这个信息是因为atomikos在默认情况下是将console_file_name和log_base_name设置为默认值:tm.out和tmlog0.log,并且会将这两个文件上锁,导致其他线程无法访问,所以当多个项目都未指定这一名称时就会出现上述异常信息
该问题主要出现在 Windows 环境下. Linux下不会
问题是很这样的:1. 当在Eclipse 使用 maven的Tomcat 插件启动的时候,是不会报错的;
2. 当将war包放到 tomcat 容器中,启动Tomcat server的时候,就会报错.
解决办法:
在每一个项目中都指定atomikos的文件名称,修改jta.properties文件中的
com.atomikos.icatch.console_file_name
com.atomikos.icatch.log_base_name
两个属性的值,保证每个项目的名称都不一样
例如:
第一个项目中使用默认值,则自动生成为tm.out、tm.out.lck和tmlog0.log、tmlog.log.lck四个文件;
第二个项目中在jta.properties文件中指定属性名称:
com.atomikos.icatch.console_file_name = rm.out
com.atomikos.icatch.log_base_name = rmlog.log
启动服务时就会自动生成rm.out、rm.out.lck和rmlog0.log、rmlog.log.lck四个文件;
这时两个项目使用的文件就不会产生冲突