public class TransactedFileCopy {
public static void main(String[] args) throws IOException{
final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FileAppender.class);
LoggerFacade loggerFacade = new Log4jLogger(logger);
String tempDir = "c:/TransactedFileCopy";
String tempDirOut = "c:/TransactedFileCopy/out";
FileResourceManager frm = new FileResourceManager(tempDir, tempDirOut, false, loggerFacade);
String storedir = frm.getStoreDir();
String workdir = frm.getWorkDir();
OutputStream outputStream;
Object txId = null;
try {
frm.start();
txId = frm.generatedUniqueTxId();
frm.startTransaction(txId);
frm.copyResource(txId, storedir, workdir, true);
frm.commitTransaction(txId);
}
catch (Exception e) {
throw new IOException("DB rollback");
}
}
}
I am doing the same as Apache Transaction:write file transactionally - how to use resourceId but I have the following exception.
org.apache.commons.transaction.file.ResourceManagerSystemException:
16ad53e99b9-0:
Can not write to resource at
'C:/Temp/TransactedFileCopy/out/Assures.Service-
20180711.log' (ERR_SYSTEM)
Caused by: java.io.IOException: The filename, directory name, or volume
label syntax
is incorrect
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at
org.apache.commons.transaction.util.FileHelper.createFile(FileHelper.java:75) at