Bom dia! fiz não estou conseguindo entender esse erro que esta acontecendo no codigo que faz a trasnferencia de aqruivos via ftp, alguém pode me esclarecer o motivo do problema, antes ele funcionava perfeitamente, agora aparece essa msg no console.
esse é o código fonte
public boolean conectandoFTp(String savePathFull, String fileName, String string, String nome) throws IOException, SocketException {
try {
dc=new DaosCrudeIb();
ftp = new FTPClient();
BeanTempImg bti =null;
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out),true));//escrevo as respostas do servidor ftp o true esconde usuario ea senha
ftp.connect(server, port);
ftp.setDataTimeout(timeout);
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
throw new IOException("Houve algum erro com a conexao com o FTP Server");
}
ftp.login(user, password);
ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
// ftp.setUseEPSVwithIPv4( true );
ftp.enterLocalPassiveMode();
if (!diretorio.exists()) {
ftp.makeDirectory(caminho);
}
ftp.changeWorkingDirectory(caminho);
arqEnviar = new FileInputStream(savePathFull);
if (ftp.storeFile(fileName, arqEnviar)) {
bti=new BeanTempImg();
bti.setCaminho(bti.getCaminho()+fileName);
bti.setId(string);
bti.setUser(nome);
dc.insereCaminhoImg(bti);
// JOptionPane.showMessageDialog(null, "meu nome e o "+fileName+ " e meu id e "+ bti.getId()+" meu link "+bti.getCaminhoString());
System.out.println("ftp--------"+ bti.getCaminho());
return true;
}
}catch(Exception e) {
e.printStackTrace();
}finally {
arqEnviar.close();
this.ftp.logout();
this.ftp.disconnect();
}
return false;
}
227 Entering Passive Mode (156,67,222,197,139,140).
STOR Produto13539716371.jpg
421 Idle timeout (60 seconds): closing control connection
org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received. Server closed connection.
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:378)
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:719)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:514)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:873)
at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:1053)
at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3816)
at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3846)
at model.ConectaFTP.conectandoFTp(ConectaFTP.java:67)
at controle.UploadImg.service(UploadImg.java:102)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:355)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:866)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1708)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
QUIT
fev. 16, 2023 10:35:11 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [UploadImg] in context with path [/Blincos] threw exception
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:314)
at org.apache.commons.net.ftp.FTP.getReply(FTP.java:719)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:514)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:635)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:609)
at org.apache.commons.net.ftp.FTP.quit(FTP.java:903)
at org.apache.commons.net.ftp.FTPClient.logout(FTPClient.java:2875)
at model.ConectaFTP.conectandoFTp(ConectaFTP.java:82)
at controle.UploadImg.service(UploadImg.java:102)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:355)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:866)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1708)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
desde já agradeço qualquer tipo de ajuda que faça concertar.