Java 更改BTM tlog文件位置
我们正在使用Java 更改BTM tlog文件位置,java,jta,bitronix,Java,Jta,Bitronix,我们正在使用org.codehaus.btm:btm:2.1.4进行测试,我们看到这些文件出现在我们的maven模块目录(即工作目录)中: btm1.tlog btm2.tlog 我希望在另一个目录中创建它们,例如在target/btmlogs/中。如何配置BTM来实现此目的?您必须配置TransactionManager 在名为src/main/resources/bitronix default config.properties的文件中执行此操作。大概是这样的: # Avoid war
org.codehaus.btm:btm:2.1.4
进行测试,我们看到这些文件出现在我们的maven模块目录(即工作目录)中:
btm1.tlog
btm2.tlog
我希望在另一个目录中创建它们,例如在
target/btmlogs/
中。如何配置BTM来实现此目的?您必须配置TransactionManager
在名为src/main/resources/bitronix default config.properties的文件中执行此操作。大概是这样的:
# Avoid warnings in test log
bitronix.tm.serverId=foo-bar
# Disable tlog files
bitronix.tm.journal=null
# In case the journal is enabled locally, avoid that the btm1.tlog and btm2.tlog files are created in the module's directory
# causing gitignore, mvn clean and IDE indexing issues
bitronix.tm.journal.disk.logPart1Filename=target/btm/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=target/btm/btm2.tlog
您必须配置TransactionManager
在名为src/main/resources/bitronix default config.properties的文件中执行此操作。大概是这样的:
# Avoid warnings in test log
bitronix.tm.serverId=foo-bar
# Disable tlog files
bitronix.tm.journal=null
# In case the journal is enabled locally, avoid that the btm1.tlog and btm2.tlog files are created in the module's directory
# causing gitignore, mvn clean and IDE indexing issues
bitronix.tm.journal.disk.logPart1Filename=target/btm/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=target/btm/btm2.tlog
poolgDataSource.getDriverProperties().setProperty(“bitronix.tm.journal.disk.logPart1Filename”,“target/btm/my-btm1.tlog”)代码>导致一个bitronix.tm.utils.PropertyException:类'bitronix.tm.resource.jdbc.lrc.LrcXADataSource'中没有可读属性'bitronix'
使用TransactionManagerServices.getConfiguration()
而导致非法状态异常:无法在事务管理器运行时更改配置。在静态构造函数中而不是在每个JUnit测试开始时执行这些操作会导致除第一个测试之外的所有测试都写入错误的目录(因此忽略属性)。已修复。我已经在答案中添加了添加这些道具的文件:bitronix default config.properties.poolgdatasource.getDriverProperties().setProperty(“bitronix.tm.journal.disk.logPart1Filename”,“target/btm/my-btm1.tlog”)代码>导致一个bitronix.tm.utils.PropertyException:类'bitronix.tm.resource.jdbc.lrc.LrcXADataSource'中没有可读属性'bitronix'
使用TransactionManagerServices.getConfiguration()
而导致非法状态异常:无法在事务管理器运行时更改配置。在静态构造函数中而不是在每个JUnit测试开始时执行这些操作会导致除第一个测试之外的所有测试都写入错误的目录(因此忽略属性)。已修复。我已经在答案中添加了一个文件来添加这些道具:bitronix-default-config.properties。