当前位置: 动力学知识库 > 问答 > 编程问答 >

servlets - TomEE / Tomcat refuses FTP connection

问题描述:

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:

grant {

permission java.net.SocketPermission "10.0.2.161:1-","connect,accept,listen,resolve";

permission java.net.SocketPermission "localhost:1-","connect,accept,listen,resolve";

permission java.security.AllPermission;

};

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?

分享给朋友:
您可能感兴趣的文章:
随机阅读: