I am trying to convert an EDIFACT file into an XML file. The conversion is done with smooks. The conversion works fine. The target file is successfully converted and also written to the disk. The problem arises after when Camel try to move the file to the .camel subdir. The source file is copied to the subdir, but the original file cannot be deleted.
Environment: Windows 10, Java 11, Camel 3.15, Smooks 2.0.0RC1, running in eclipse If I omit the line with ".process(processor)", the file can be moved/deleted. But with executing the smooks step it always gives me error messages, (attached at the end of this post) Following code shows the main program: public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { Smooks smooks = new Smooks(); smooks.setReaderConfig(new EdifactReaderConfigurator("/d01b/EDIFACT-Messages.dfdl.xsd")); smooks.setExports(new Exports(StringResult.class)); SmooksProcessor processor = new SmooksProcessor(smooks, context); from("file://C:/data/MediaMarkt/ORDERS/in?delay=1000") .process(processor) .to("file://C:/data/MediaMarkt/ORDERS/out/?fileName=${file:name}.xml"); } }); context.start(); Thread.sleep(20000); context.close(); } Error message: [ main] Scanner WARN Not scanning classpath for ClassLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader'. ClassLoader must implement 'java.net.URLClassLoader'. [ main] Scanner WARN Not scanning classpath for ClassLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader'. ClassLoader must implement 'java.net.URLClassLoader'. [ main] SmooksProcessor WARN Attachments module could not be found: attachments will not be propagated [ main] SmooksProcessor INFO SmooksProcessor [configUri=null] Started [ main] SmooksProcessor WARN Attachments module could not be found: attachments will not be propagated [ main] SmooksProcessor INFO SmooksProcessor [configUri=null] Started [ main] SmooksProcessor WARN Attachments module could not be found: attachments will not be propagated [ main] SmooksProcessor INFO SmooksProcessor [configUri=null] Started [ main] SmooksProcessor WARN Attachments module could not be found: attachments will not be propagated [ main] SmooksProcessor INFO SmooksProcessor [configUri=null] Started [ main] SmooksProcessor WARN Attachments module could not be found: attachments will not be propagated [ main] SmooksProcessor INFO SmooksProcessor [configUri=null] Started [ main] AbstractCamelContext INFO Routes startup (total:1 started:1) [ main] AbstractCamelContext INFO Started route1 (file://C:/data/MediaMarkt/ORDERS/in) [ main] AbstractCamelContext INFO Apache Camel 3.15.0 (camel-1) started in 193ms (build:36ms init:136ms start:21ms) CamelContext status: Started [//C:/data/MediaMarkt/ORDERS/in] DataProcessorFactory INFO Compiling and caching DFDL schema... [//C:/data/MediaMarkt/ORDERS/in] GenericFileOnCompletion WARN Error during commit. Exchange[0C5E19CEB8FC187-0000000000000000]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Error renaming file from C:\data\MediaMarkt\ORDERS\in\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi to C:\data\MediaMarkt\ORDERS\in\.camel\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi] org.apache.camel.component.file.GenericFileOperationFailedException: Error renaming file from C:\data\MediaMarkt\ORDERS\in\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi to C:\data\MediaMarkt\ORDERS\in\.camel\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:93) ~[camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:145) ~[camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:121) ~[camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:134) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:86) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:60) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.support.UnitOfWorkHelper.doneSynchronization(UnitOfWorkHelper.java:104) [camel-support-3.15.0.jar:3.15.0] at org.apache.camel.support.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:93) [camel-support-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.DefaultUnitOfWork.done(DefaultUnitOfWork.java:238) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.support.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:61) [camel-support-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:778) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:713) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.CamelInternalProcessor$AsyncAfterTask.done(CamelInternalProcessor.java:264) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.AsyncCallback.run(AsyncCallback.java:44) [camel-api-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:187) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.processor.Pipeline.process(Pipeline.java:184) [camel-core-processor-3.15.0.jar:3.15.0] at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:399) [camel-base-engine-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:492) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:245) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:206) [camel-file-3.15.0.jar:3.15.0] at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:202) [camel-support-3.15.0.jar:3.15.0] at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:116) [camel-support-3.15.0.jar:3.15.0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?] at java.lang.Thread.run(Thread.java:832) [?:?] Caused by: java.io.IOException: Renaming file from 'C:\data\MediaMarkt\ORDERS\in\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi' to 'C:\data\MediaMarkt\ORDERS\in\.camel\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi' failed: Cannot delete file 'C:\data\MediaMarkt\ORDERS\in\ORDERS 000397700717-000397700717.2802b732-98b2-11ec-99b2-8e02ac1b4884.edi' after copy succeeded at org.apache.camel.util.FileUtil.renameFileUsingCopy(FileUtil.java:464) ~[camel-util-3.15.0.jar:3.15.0] at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:436) ~[camel-util-3.15.0.jar:3.15.0] at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:90) ~[camel-file-3.15.0.jar:3.15.0] ... 28 more
pom.xml
Description: pom.xml