Error message
FTP upload file report org apache. commons. net. ftp. Ftpconnectionclosedexception: connection closed without indication error
In the project, due to ftp migration, the ftpclient used by the code logs in successfully, but this error is reported when uploading the file.
code
public boolean uploadFile(String ip, int port, String username, String password, String serverpath, String file) { // Initial indicates upload failed boolean success = false; // Create FTPClient object FTPClient ftp = new FTPClient(); ftp.setControlEncoding("UTF-8"); ftp.setConnectTimeout(20000); ftp.setDataTimeout(600000); ftp.enterLocalPassiveMode(); ftp.setActivePortRange(4000, 4100); try { int reply=0; // Connect to FTP server // If you use the default port, you can use FTP Connect (IP) directly to the FTP server ftp.connect(ip, port); //ftp.connect("192.168.20.221", 21); // Login ftp ftp.login(username, password); // Check whether the returned value is reply > = 200 & & reply < 300. If yes, it indicates that the login is successful reply = ftp.getReplyCode(); logger.info("connect ftp Server response code, reply={}",reply); // The return value starting with 2 will be true if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return success; } ftp.setActivePortRange(40000, 41000); logger.info("ftp Connection succeeded... file = {}, serverpath = {}", file, serverpath); checkPathExist(ftp,iso8859ToGbk(serverpath)); //Input stream InputStream input=null; try { file=gbkToIso8859(file); input = new FileInputStream(iso8859ToGbk(file)); } catch (Exception e) { LoggerFactory.getLogger(this.getClass()).error("Error reading uploaded file",e); } // Store the uploaded file in the specified directory file=iso8859ToGbk(file); String fileName = getFilename(file);//8859 int index = fileName.lastIndexOf("."); String tmpFileName = fileName.substring(0,index)+".tmp"; ftp.deleteFile(iso8859ToGbk(fileName)); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); String ftpPath = iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(tmpFileName); logger.info("Before uploading ftp route, ftpPath = {}",ftpPath); boolean flag = ftp.storeFile(ftpPath, input); logger.info("After uploading the file, upload the results flag = {}", flag); // Close input stream input.close(); if(flag){ ftp.rename(iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(tmpFileName), iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(fileName)); success = true; } // Exit ftp ftp.logout(); } catch (IOException e) { success = false; LoggerFactory.getLogger(this.getClass()).error("Upload data to ftp error",e); } finally { if (ftp.isConnected()) { try { ftp.disconnect(); } catch (IOException ioe) { LoggerFactory.getLogger(this.getClass()).info(ioe.toString()); } } } return success; }
Introduction to ftp active and passive mode
Active mode: the FTP client sends a connection request to the FTP control PORT (21 by default) of the server, and the server accepts the connection and establishes a command link; When it is necessary to transmit data, the client uses the PORT command on the command link to tell the server that I have opened a PORT, and you come to connect me. Therefore, the server sends a connection request from PORT 20 to the PORT of the client and establishes a data link to transmit data. In the process of data link establishment, the server actively requests, so it is called active mode.
Passive mode: the FTP client sends a connection request to the FTP control port (default 21) of the server, and the server accepts the connection and establishes a command link; When data needs to be transmitted, the server uses PASV command on the command link to tell the client that I have opened a port and you come to connect me. So the client sends a connection request to the port of the server and establishes a data link to transmit data. In the process of data link establishment, the server passively waits for the request of the client, so it is called passive mode.
Cause analysis
From the code above, we can see that after the ftp login is successful, ftp is executed setActivePortRange(40000, 41000);, This means that the active mode is used to transmit data. The active mode requires the ftp server to connect to our port. As a result, the ftp server cannot connect to the client port due to network problems, so this error is reported.
Solution
For this problem, there should be two solutions: first, open the network, which is the port where the ftp server can connect the client 40000 ~ 41000; 2, Is to change to passive mode.
Here I take the second method: after the ftp client logs in successfully (the execution before login is invalid), execute ftp enterLocalPassiveMode(); The final code is as follows:
public boolean uploadFile(String ip, int port, String username, String password, String serverpath, String file) { // Initial indicates upload failed boolean success = false; // Create FTPClient object FTPClient ftp = new FTPClient(); ftp.setControlEncoding("UTF-8"); ftp.setConnectTimeout(20000); ftp.setDataTimeout(600000); ftp.enterLocalPassiveMode(); ftp.setActivePortRange(4000, 4100); try { int reply=0; // Connect to FTP server // If you use the default port, you can use FTP Connect (IP) directly to the FTP server ftp.connect(ip, port); //ftp.connect("192.168.20.221", 21); // Login ftp ftp.login(username, password); // Check whether the returned value is reply > = 200 & & reply < 300. If yes, it indicates that the login is successful reply = ftp.getReplyCode(); logger.info("connect ftp Server response code, reply={}",reply); // The return value starting with 2 will be true if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return success; } ftp.enterLocalPassiveMode();// This is changed to passive mode logger.info("ftp Connection succeeded... file = {}, serverpath = {}", file, serverpath); checkPathExist(ftp,iso8859ToGbk(serverpath)); //Input stream InputStream input=null; try { file=gbkToIso8859(file); input = new FileInputStream(iso8859ToGbk(file)); } catch (Exception e) { LoggerFactory.getLogger(this.getClass()).error("Error reading uploaded file",e); } // Store the uploaded file in the specified directory file=iso8859ToGbk(file); String fileName = getFilename(file);//8859 int index = fileName.lastIndexOf("."); String tmpFileName = fileName.substring(0,index)+".tmp"; ftp.deleteFile(iso8859ToGbk(fileName)); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); String ftpPath = iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(tmpFileName); logger.info("Before uploading ftp route, ftpPath = {}",ftpPath); boolean flag = ftp.storeFile(ftpPath, input); logger.info("After uploading the file, upload the results flag = {}", flag); // Close input stream input.close(); if(flag){ ftp.rename(iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(tmpFileName), iso8859ToGbk(serverpath)+"/"+iso8859ToGbk(fileName)); success = true; } // Exit ftp ftp.logout(); } catch (IOException e) { success = false; LoggerFactory.getLogger(this.getClass()).error("Upload data to ftp error",e); } finally { if (ftp.isConnected()) { try { ftp.disconnect(); } catch (IOException ioe) { LoggerFactory.getLogger(this.getClass()).info(ioe.toString()); } } } return success; }
I hope it will be helpful to you.
Эта ошибка возникает на файлы загрузки Linux, используя ftpclient
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:317)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:483)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:608)
at org.apache.commons.net.ftp.FTP.cwd(FTP.java:828)
at org.apache.commons.net.ftp.FTPClient.changeWorkingDirectory(FTPClient.java:1128)
at com.taotao.test.FTPTest.testFTP(FTPTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
В конце концов, путем изменения разрешений файла на сервере его можно успешно выполнить, и этот метод использовался для сохранения файла для открытия разрешений этого пользователя для выполнения (X), я напрямую устанавливаю (rwx)
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
Please follow the issue template and provide more details. issues like this do not provide any way of replicating the problem and spotting if it’s an Apache Commons FTP bug or an Android Upload Service bug. Thank you!
English is poor, please forgive me。
Using FTP to upload files to the window server was correct yesterday, but it went wrong today. The device system is android4.4.4
Sorry, but you have to follow what is in the issue template and provide necessary details, otherwise I couldn’t help you in any way
The same file, second pass will make mistakes ,and return «Error while uploading: xx to xx»
I don’t understand the code
try { String remoteFileName = getRemoteFileName(file); if (!ftpClient.storeFile(remoteFileName, localStream)) { throw new IOException("Error while uploading: " + file.getName(service) + " to: " + file.getProperty(PARAM_REMOTE_PATH)); } setPermission(remoteFileName, file.getProperty(PARAM_PERMISSIONS)); } finally { localStream.close(); }
The exception is thrown because the transfer of the file to your FTP directory is not possible. I don’t have the Apache Commons Net FTP docs at hand, but this may be due to permission policy for your FTP user or if the file already exists, in which case it doesn’t get overwritten.
Can you successfully upload the file for the first time? If I understand correctly, you get the exception only the second time you try to upload it.
Successfully upload the file for the first time.But,Some FTP servers can upload second times。
I’ll see if the FTP service is insufficient。
Example:
new FTPUploadRequest(mContext, _ip, _port)
.setUsernameAndPassword(_accout, _pwd)
.addFileToUpload(path, to)
.setNotificationConfig(config)
.setCreatedDirectoriesPermissions(new UnixPermissions(«777»))
.setSocketTimeout(301000)
.setConnectTimeout(301000)
Here it’s storeFile method JavaDoc. The method should overwrite the existing file the second time you try to make an upload.
The best way to check if the problem is in the library or in your FTP server config is to use one of the test FTP servers
You are right,this is FTP server Permission denied。
thanks
After installing the ftp server yesterday, I was trying to connect to it with the commons-net library. Unfortunately it kept failing:
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:297)
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:619)
at org.apache.commons.net.ftp.FTPClient.completePendingCommand(FTPClient.java:1244)
at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1301)
As download worked from the browser, I thought this kinda odd. Looking a little closer, I decided to manually try the steps from the command line and see if I could figure out what was going on.
I ftp’d in and did the same commands I was doing from Java (passive, binary, etc).
When I tried to ‘get
‘ I saw:
150 Opening BINARY mode data connection for aopalliance-1.0.jar (6371 bytes).
421 Service not available, remote server has closed connection
ftp>
Since I had found through my debugging that after the exception, the 150 FILE_STATUS_OK was the last reply I got; I looked up 421. It appears that there is a current bug on OpenSolaris that causes this behavior.
So here’s the workaround (for the setup I did yesterday):
cp /lib/libsendfile.so.1 /home/ftp/lib
chown root:bin /home/ftp/lib/libsendfile.so.1
svcadm restart ftp
Everything works beautifully now
#android #sockets #exception #ftp-client
#Android #сокеты #исключение #ftp-клиент
Вопрос:
Я пытаюсь загрузить изображение, снятое камерой, на FTP-сервер, я использую объект FTPClient, и он успешно работает при запуске кода Java на компьютере, но при запуске кода на устройстве Android происходит сбой.
Я проверил разрешение на доступ в Интернет, также подключение к Интернету стабильно, также другие функции, связанные с Интернетом, работают правильно, только этот ftp-клиент не работает.
Вот код:
FTPClient ftpClient = new FTPClient();
ftpClient.connect("ftp.mywebsite.com",21);
Пожалуйста, обратите внимание, что mywebsite
это всего лишь держатель места.
Он выдает следующее исключение FTPConnectionClosedException
W/System.err: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
W/System.err: at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:324)
W/System.err: at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:300)
W/System.err: at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:425)
W/System.err: at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:962)
W/System.err: at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:950)
W/System.err: at org.apache.commons.net.SocketClient._connect(SocketClient.java:244)
W/System.err: at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
W/System.err: at com.basma.basma_rider.Helper$3.doInBackground(Helper.java:367)
W/System.err: at com.basma.basma_rider.Helper$3.doInBackground(Helper.java:342)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err: at java.lang.Thread.run(Thread.java:841)
|
|
|
Следующие правила действуют в данном разделе в дополнение к общим Правилам Форума
1. Здесь обсуждается Java, а не JavaScript! Огромная просьба, по вопросам, связанным с JavaScript, SSI и им подобным обращаться в раздел WWW Masters или, на крайний случай, в Многошум.
2. В случае, если у вас возникают сомнения, в каком разделе следует задать свой вопрос, помещайте его в корневую ветку форума Java. В случае необходимости, он будет перемещен модераторами (с сохранением ссылки в корневом разделе).
3. Запрещается создавать темы с просьбой выполнить какую-то работу за автора темы. Форум является средством общения и общего поиска решения. Вашу работу за Вас никто выполнять не будет.
4. Не рекомендуется создавать несколько несвязанных вопросов в одной теме. Пожалуйста, создавайте по одной теме на вопрос.
apache commons-net. FTP
, не могу законнектиться
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
Простейший пример. Пытаюсь подсоединиться к локальному компу. Выбрасывает исключение. Где и что не так? import java.io.*; import org.apache.commons.net.ftp.*; public class SortNumbers { public static void main(String[] args) throws IOException { FTPClient ftp = new FTPClient(); ftp.connect(«127.0.0.1»); FTPListParseEngine engine = ftp.initiateListParsing(«Temp»);//просмотр всех файлов в папке while (engine.hasNext()) { FTPFile[] files = engine.getNext(25); int lng = files.length; for (int i = 0; i < lng; i++) { String nameFile = files[i].getName(); System.out.println(nameFile); } } } } Такое вот исключение: Exception in thread «main» java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364) at java.net.Socket.connect(Socket.java:507) at java.net.Socket.connect(Socket.java:457) at java.net.Socket.<init>(Socket.java:365) at java.net.Socket.<init>(Socket.java:178) at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53) at org.apache.commons.net.SocketClient.connect(SocketClient.java:162) at org.apache.commons.net.SocketClient.connect(SocketClient.java:250) at SortNumbers.main(SortNumbers.java:12) |
wind |
|
Moderator Рейтинг (т): 269 |
В данном случае исключение говорит о том, что порт, по которому подключается клиент, никто не слушает. Попробуйте явно задать порт. |
Alita |
|
Цитата wind @ 24.04.07, 08:27 Попробуйте явно задать порт. В этом случае вывалилось: Exception in thread «main» org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication. at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:267) at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:335) at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:550) at org.apache.commons.net.SocketClient.connect(SocketClient.java:163)
|
wind |
|
Moderator Рейтинг (т): 269 |
А что в логах вашего ftp-сервера? Попытка соединения была? Кстати, что за сервер вы используете? |
Alita |
|
Все из-за невнимательности — проблема оказалась как раз в фтп сервере. Извиняюсь за беспокойство. |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- Java
- Следующая тема
[ Script execution time: 0,0795 ] [ 15 queries used ] [ Generated: 9.04.23, 01:40 GMT ]
I’m using Camel 2.15.2 with Apache Commons Net 3.3 on Java 8 deployed into a Tomcat container.
The issue is that consistently after processing just over 200 files (> 4000 files in the directory) the route stops, the FTP client disconnects and the following message is logged out:
[ogs.sharp-stream.com:21/root/] FtpConsumer WARN Error processing file RemoteFile[route/to/file] due to File operation failed: Connection closed without indication.. Code: 421. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - File operation failed: Connection closed without indication.. Code: 421]
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: Connection closed without indication.. Code: 421
at org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:713)
at org.apache.camel.component.file.remote.FtpOperations.retrieveFileToFileInLocalWorkDirectory(FtpOperations.java:440)
at org.apache.camel.component.file.remote.FtpOperations.retrieveFile(FtpOperations.java:310)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:384)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:317)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:483)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:608)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:582)
at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1454)
at org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:2658)
at org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:709)
... 15 more
This is the URI used at the begining of the related route.
As you can tell from the URI I’m also using a FileIdempotentRepository. It’s defined like this
<property name="fileStore" value="target/fileidempotent/.filestore1.dat" />
<property name="maxFileStoreSize" value="512000" />
<property name="cacheSize" value="250" />
</bean>
Any ideas why the connection might be closing before all files are processed?
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
Please follow the issue template and provide more details. issues like this do not provide any way of replicating the problem and spotting if it’s an Apache Commons FTP bug or an Android Upload Service bug. Thank you!
English is poor, please forgive me。
Using FTP to upload files to the window server was correct yesterday, but it went wrong today. The device system is android4.4.4
Sorry, but you have to follow what is in the issue template and provide necessary details, otherwise I couldn’t help you in any way
The same file, second pass will make mistakes ,and return «Error while uploading: xx to xx»
I don’t understand the code
try { String remoteFileName = getRemoteFileName(file); if (!ftpClient.storeFile(remoteFileName, localStream)) { throw new IOException("Error while uploading: " + file.getName(service) + " to: " + file.getProperty(PARAM_REMOTE_PATH)); } setPermission(remoteFileName, file.getProperty(PARAM_PERMISSIONS)); } finally { localStream.close(); }
The exception is thrown because the transfer of the file to your FTP directory is not possible. I don’t have the Apache Commons Net FTP docs at hand, but this may be due to permission policy for your FTP user or if the file already exists, in which case it doesn’t get overwritten.
Can you successfully upload the file for the first time? If I understand correctly, you get the exception only the second time you try to upload it.
Successfully upload the file for the first time.But,Some FTP servers can upload second times。
I’ll see if the FTP service is insufficient。
Example:
new FTPUploadRequest(mContext, _ip, _port)
.setUsernameAndPassword(_accout, _pwd)
.addFileToUpload(path, to)
.setNotificationConfig(config)
.setCreatedDirectoriesPermissions(new UnixPermissions(«777»))
.setSocketTimeout(301000)
.setConnectTimeout(301000)
Here it’s storeFile method JavaDoc. The method should overwrite the existing file the second time you try to make an upload.
The best way to check if the problem is in the library or in your FTP server config is to use one of the test FTP servers
You are right,this is FTP server Permission denied。
thanks
Эта ошибка возникает на файлы загрузки Linux, используя ftpclient
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:317)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:483)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:608)
at org.apache.commons.net.ftp.FTP.cwd(FTP.java:828)
at org.apache.commons.net.ftp.FTPClient.changeWorkingDirectory(FTPClient.java:1128)
at com.taotao.test.FTPTest.testFTP(FTPTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
В конце концов, путем изменения разрешений файла на сервере его можно успешно выполнить, и этот метод использовался для сохранения файла для открытия разрешений этого пользователя для выполнения (X), я напрямую устанавливаю (rwx)