我需要使用 Apache tomcat 的系统服务将文件保存到网络驱动器并得到所有时间错误:
Exception: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: u:\xxx.txt
我的路线示例:
<route id="myRoute">
<from uri="quartz:myQuartz?cron=0+0+*+?+*+MON-FRI"/>
<camel:doTry>
<bean method="getData" ref="myService"/>
<marshal ref="bindyFixedDataformat"/>
<to uri="file:u:?fileName=xxx.txt&autoCreate=false&fileExist=Append"/>
<to uri="file://c:/XXX/files?fileName=xxx-${date:now:yyyyMMdd}.txt"/>
<camel:bean method="setProcessed" ref="myService"/>
<camel:doCatch>
<exception>java.io.IOException</exception>
<camel:log message="Network drive (U:) is not available, please renew connection!" loggingLevel="ERROR"/>
<camel:bean method="setFailed" ref="myService"/>
</camel:doCatch>
<camel:doCatch>
<exception>java.lang.Exception</exception>
<camel:log message="Unexpected error has occured!" loggingLevel="ERROR" />
<camel:bean method="setFailed" ref="myService"/>
</camel:doCatch>
</camel:doTry>
</route>
“U”盘是映射的网盘。但是与我的第二个分区磁盘“D”文件相同的路线创建成功。
我正在生成 WAR 文件并使用 Apache Tomcat 的本地系统服务运行它。
有趣的是,在服务之前,当我通过 maven 使用 eclipse 运行同一个项目时 - 复制到 U 盘是成功的。