简体   繁体   中英

Apache camel file encrypt/ ftp upload woes on Windows

I have a java web application that creates a file in a folder. These files are picked up by a camel route that pgp encrypts it and then ftp's it. Initially, I had it as one route and it worked on my windows servers. Then it stopped working. So, I split it into two routes that way even if ftp fails I won't have unencrypted files lying on the server. Plus, I can manually ftp those, if needed (not ideal). Now, it works on one server but not another. Both are windows servers, my application server is tomcat.

Is there a reliable way to make this work across servers?

The routes are shown below

<route id="file_encrypt">
  <from uri="file://{{rootOutputDirectory}}/thirdparty/outbound?readLock=rename&amp;delete=true"/>
  <setHeader headerName="cryptoKeyFile">
    <simple>${properties:thirdparty.pgpkey}</simple>
  </setHeader>
  <to uri="bean:PGPEncryptProcessor"/>
  <to uri="file://{{rootOutputDirectory}}/thirdparty/outbound/encrypted"/>
</route>

<route id="file_ftp">
  <from uri="file://{{rootOutputDirectory}}/thirdparty/outbound/encrypted/?readLock=rename&amp;move=.done&amp;moveFailed=.error"/>
  <to uri="ftp://{{thirdparty.ftp.user}}@{{thirdparty.ftp.url}}{{thirdparty.ftp.outgoingdir}}/?password={{thirdparty.ftp.password}}&amp;binary=true"/>
</route>

The value of thirdparty.ftp.outgoingdir is

thirdparty.ftp.outgoingdir=/test/incoming

I see the following error in the log

org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 550 Failed to change directory.

It seems like the issue listed here - http://camel.465427.n5.nabble.com/Cannot-change-directory-to-quot-Code-550-on-FTP-component-td5734612.html . However, it is not clear why it works on one server but not another with the same settings.

Turns out the commons-net version was different across different servers - one had 3.1 (works) and other had 3.2 (doesn't work). I am not sure how that happened (looking into it). However, switching the commons-net to 3.1 across all servers got it working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM