I have a system running on TomEE (Tomcat with added Java EE if you don't know it). In the server I have a servlet that needs to upload and download files to/from another FTP server. However I keep getting a ConnectException with the message "Connection refused".
I checked my credentials in FileZilla and I connected to the server just fine. I tried running identical code in a standalone Jar on the same server as the TomEE installation - and it ran fine. So I kinda narrowed it down to the TomEE server.
I suspect it might have something to do with permissions, and I have tried adding the following to the catalina.policy file:
permission java.net.SocketPermission "10.0.2.161:1-","connect,accept,listen,resolve";
permission java.net.SocketPermission "localhost:1-","connect,accept,listen,resolve";
Where 10.0.2.161 is the FTP server. I tried different combinations of the above, nothing works.. Any takers on what might be preventing my servlet from connecting to the FTP server?