1
resposta

Erro quando Compila após inserir a dependency javax.xml.bind



set 01, 2020 4:34:22 PM net.sf.json.xml.XMLSerializer getType
INFO: Using default type string
INFO 16:34:22.112 - {"id":"2451256","dataCompra":"2013-12-05T18:21:07.529-02:00","itens":[{"formato":"EBOOK","quantidade":"1","livro":{"codigo":"ARQ","titulo":"Introdução à Arquitetura e Design de Software","tituloCurto":"Arquitetura Java","nomeAutor":"Sergio Lopes, Paulo Silveira, Guilherme Silveira, Nico Steppat, outros","valorEbook":"29.90","valorImpresso":"79.90"}}],"pagamento":{"status":"CONFIRMADO","valor":"29.90","titular":"Edgar  Brião","email-titular":"edgar.b@abc.com"}}
WARN 16:34:26.221 - Error during commit. Exchange[ID-BRPC003131-59234-1598988860176-0-2][1_pedido.xml]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Error renaming file from C:\Users\vlms\eclipse-workspace\projeto-camel-alura\camel-alura\pedidos\1_pedido.xml to pedidos\.camel\1_pedido.xml]
org.apache.camel.component.file.GenericFileOperationFailedException: Error renaming file from C:\Users\vlms\eclipse-workspace\projeto-camel-alura\camel-alura\pedidos\1_pedido.xml to pedidos\.camel\1_pedido.xml
    at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:81) ~[camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:113) ~[camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:88) ~[camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:57) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104) [cameinsira seu código aquil-core-2.16.0.jar:2.16.0]
    at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:229) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:653) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:608) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:239) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:109) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:442) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:214) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:178) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.16.0.jar:2.16.0]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.base/java.lang.Thread.run(Thread.java:830) [?:?]
Caused by: java.io.IOException: Renaming file from 'C:\Users\vlms\eclipse-workspace\projeto-camel-alura\camel-alura\pedidos\1_pedido.xml' to 'pedidos\.camel\1_pedido.xml' failed: Cannot delete file 'C:\Users\vlms\eclipse-workspace\projeto-camel-alura\camel-alura\pedidos\1_pedido.xml' after copy succeeded
    at org.apache.camel.util.FileUtil.renameFileUsingCopy(FileUtil.java:510) ~[camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:482) ~[camel-core-2.16.0.jar:2.16.0]
    at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:78) ~[camel-core-2.16.0.jar:2.16.0]
1 resposta

Isso é um problema do camel para windows, parece que arrumaram nas versões mais recentes.

por hora, tenta converter o body da mensagem para byte[]:

file(...). convertBodyTo(byte[].class) ....

Exemplo:

from("file:gws-pkupdate").
            routeId("rota-prof-file").
            convertBodyTo(byte[].class).
            marshal()
                .xmljson().        
                setHeader(Exchange.CONTENT_TYPE, constant("application/json")).
                setHeader(Exchange.HTTP_CHARACTER_ENCODING, constant("UTF-8")).
                setHeader("CamelFileName", simple("${file:name.noext}.json")).
                log("Evento ProtFile: ${body}").    
            to("file:jsonmanager")
                .log(">>>FIM DA ROTA ProtFileRouter");