atomikos(com.atomikos.icatch.SysException: Error in init(): Log already in use)

当在同一环境中部署多个使用Atomikos的项目时,可能会遇到com.atomikos.icatch.SysException:Errorininit():Logalreadyinuse错误。此文章介绍了解决方法:通过修改每个项目的jta.properties文件中的com.atomikos.icatch.console_file_name和com.atomikos.icatch.log_base_name属性值来避免文件名冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关键字:atomikos(com.atomikos.icatch.SysException: Error in init(): Log already in use)


com.atomikos.icatch.SysException: Error in init(): Log already in use

在项目中使用atomikos时,如果在同一个环境中部署两个以上这种项目,则可能会报出com.atomikos.icatch.SysException: Error in init(): Log already in use异常,这个信息是因为atomikos在默认情况下是将console_file_name和log_base_name设置为默认值:tm.out和tmlog0.log,并且会将这两个文件上锁,导致其他线程无法访问,所以当多个项目都未指定这一名称时就会出现上述异常信息

解决办法:

在每一个项目中都指定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四个文件;

这时两个项目使用的文件就不会产生冲突


问题解决了
18:02:39 saut ERROR c.a.persistence.imp.LogFileLock - ERROR: the specified log seems to be in use already: saut.release.log in C:\Users\迈克\AppData\Local\JetBrains\IntelliJIdea2023.3\tomcat\b0535009-facf-44e6-b0cb-ce02f38952a9/logs/\. Make sure that no other instance is running, or kill any pending process if needed. 18:02:39 saut ERROR o.s.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperConfigurer' defined in class path resource [springfox/documentation/spring/web/SpringfoxWebMvcConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'transactionInterceptor' defined in class path resource [com/guoxinqitong/framework/config/TransactionManagerConfig.class]: Unsatisfied dependency expressed through method 'transactionInterceptor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction' defined in class path resource [com/guoxinqitong/framework/config/TransactionManagerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.transaction.UserTransaction]: Factory method 'userTransaction' threw exception; nested exception is com.atomikos.icatch.SysException: Error in init: Log already in use? saut.release.log in C:\Users\迈克\AppData\Local\JetBrains\IntelliJIdea2023.3\tomcat\b0535009-facf-44e6-b0cb-ce02f38952a9/logs/\ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:537) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) at org.springframework.c
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值