寻找使用Apache的FTP客户端帮助诊断服务器套接字问题,FTP传输 [英] Looking for help diagnosing server socket problem with FTP transfer using apache FTP Client

查看:245
本文介绍了寻找使用Apache的FTP客户端帮助诊断服务器套接字问题,FTP传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个基于Web的应用程序,它允许客户/用户将文件上传到JVM内存。服务器端code,则FTP的文件到另一台服务器。这一切工作正常,很正常,我的本地机器上,但是我现在遇到了问题,让这对我们的测试环境中的服务器上运行。

I have developed a web based application which allows a client/user to upload a file to JVM memory. The server side code then FTP's the file to another server. This all works fine and dandy on my local machine, but I'm now running into problems getting this to work on our test environment servers.

在测试环境服务器中,code成功连接,并在远程Windows服务器的日志,但文件传输过程中挂起。一个空文件在目标服务器上创建的,但没有字节传输。从堆栈跟踪JVM最终杀死线程:

On the test environment server, the code successfully connects and logs in to the remote Windows server, but hangs during file transfer. An empty file is created on the destination server but no bytes are transferred. Stack trace from JVM which eventually killed the thread:

[10/08/11 14:45:24:234 BST] 00000003 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 2" (00000033) has been active for 666083 milliseconds and may be hung.  There is/are 1 thread(s) in total in the server that may be hung.
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:431)
at java.net.ServerSocket.implAccept(ServerSocket.java:464)
at java.net.ServerSocket.accept(ServerSocket.java:432)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:693)
at org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:551)
at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1704)
... (my own app code stack trace from here on down)

看起来像一个插座的问题,但任何人都可以帮我找出哪台机器上的问题吗?它是测试环境JVM或者是目标Windows服务器?我猜测它的测试环境服务器,否则我会看到我的本地机器上这个问题?如果是测试环境中的服务器上,它是对外开放口岸的问题(如果是的话我该怎么问)?任何帮助AP最多preciated。

Looks like a socket issue, but can anyone help me figure out on which machine the issue is on? Is it the test environment JVM or is it the destination Windows server? I'm guessing its the test environment server, otherwise I would have seen this issue on my local machine? If it is on the test environment server, is it a matter of opening up ports (and if so what do I ask for)? Any help most appreciated.

推荐答案

这听起来像一个防火墙的问题对我来说,这可以通过使用被动模式的FTP客户端来解决。当在主动模式下,FTP服务器尝试传输文件和防火墙何时启动到FTP客户端的连接/ WAS可能不喜欢这一点。

It sounds like a firewall problem to me, which may be solved by using passive mode for the FTP client. When in active mode, the FTP server tries to initiate a connection to the FTP client when transferring a file and the firewall/WAS may not like that.

根据<一href=\"http://commons.apache.org/net/apidocs/org/apache/commons/net/ftp/FTPClient.html#enterLocalPassiveMode%28%29\"相对=nofollow>文档为公共ftpclient,默认模式是积极的,所以在你的code,尝试调用

According to the docs for commons ftpclient, the default mode is ACTIVE, so in your code, try calling

ftpclient.enterLocalPassiveMode();

后连接,但该文件传输之前。

after the connect, but before the file transfer.

这篇关于寻找使用Apache的FTP客户端帮助诊断服务器套接字问题,FTP传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆