SFTP via JSch is throwing error 4: Failure - java

I am facing a peculiar issue while trying to SFTP a file from Windows to Unix server. The error "stack trace" is -
4: Failure
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
at com.jcraft.jsch.ChannelSftp.checkStatus(ChannelSftp.java:2459)
at com.jcraft.jsch.ChannelSftp._sendCLOSE(ChannelSftp.java:2465)
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:683)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:475)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:365)
I have searched a lot on other forums but could not get to the root cause. I have observed one more thing - the file name, I am trying to SFTP, is *.xml when I change it to *.XML the SFTP is "successful". Very weird could not identify the issue. I am trying this using JSch Java API. But I have seen the same issue while trying the WinSCP front end.

It is common for OpenSSH SFTP server to return code 4 (Failure) for many different reasons, without giving any details.
You would have to check SFTP server log to find more.
Though the most usual cause is a lack of free disk or user quota space – Which can usually be identified by the file being created with zero size.

i was facing the same issue. was puzzled then i realized there was a space issue on the server folder. Please do check the server available space.
command: df path to the folder

I was facing the same issue. Please make sure that your SFTP service is running. And If it is already running then restarting this service should do the trick.

I had the same issue. Tried everything, turns out I had set the timeout to what I thought was 30s but it was actually 30ms. Changing it to 30000ms solved the issue.
session.setTimeout(30000);

I've seen this error and the cause in my case was, the uploaded file names weren't supported by the file system used by the SFTP server.

Related

ftp.ControlChannelIOException: Connection reset(Talend/Java)

I have a requirement to pull the files and push the files from FTP Server but I am getting the below error while pulling/fetching the files from/into FTP server. I am using Talend Open Source Data Integration Tool, also tried using custom java code and getting the same error. While I am able to pull and fetch the files using FileZilla FTP Client. I am getting the error when I am trying to pull and push the files.
Error Start ..
com.enterprisedt.net.ftp.ControlChannelIOException: Connection reset
at
com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:1014)
at
com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:1049)
at
com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:973)
at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketPASV(FTPControlSocket.java:807)
at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:563)
at
com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2561)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3468) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.tFTPFileList_2Process(FTP_Salesforce_AND_Vice_Verasa.java:488) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.tFTPConnection_1Process(FTP_Salesforce_AND_Vice_Verasa.java:396)
at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.runJobInTOS(FTP_Salesforce_AND_Vice_Verasa.java:1085) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.main(FTP_Salesforce_AND_Vice_Verasa.java:942)
Error End ..
I have already tried the below things :
Allowed java application for my firewall e.g java.exe, javaw.exe and etc.
Also tried by disabling the firewall.
used netsh advfirewall set global StatefulFTP disable command as admin.
Disabled my antivirus.
Also added TLS1.1 and TLS 1.2 into .ini file.
Also tried in different Local Machines.
Tried by writing custom java code.
Below is link to the screenshot of the talend job :
Talend Job to pull the files from FTP server
Also when I am trying another FTP credentials, not getting(Can push and pull the files from/into FTP Server) any error.
Please let me know what/where I am doing wrong.
Any help will be greatly appreciated.
Thanks in Advance.
Amit

EARs are automatically undeployed in jboss-as-7.1.1.Final

I am not getting while EARs are undeployed automatically in jboss-as-7.1.1.Final.
I can see these logs:
ERROR org.apache.tomcat.util.net.JIoEndpoint$Acceptor [run] Socket accept failed: java.net.SocketException: Too many open files
WARN com.kpn.tie.ejbs.dao.webservice.tt.WebServiceProcessor [invoke] WebService unavailable. The request could not be completed due to technical problems. ; nested exception is: java.net.SocketException: Too many open files
Can somebody tell me root cause of this behavior and also suggest solution for this.
For workaround, restarting jboss in particular time interval will resolve this issue?
The reason could be that the application is overloaded or the file descriptor settings is too low. Due to this, the JVM can not open any new file handle, so you are getting Socket accept failed for incoming requests.
After a while the Deployment-Scanner comes into play (5 sec is default) and tries to check the deployments folder, which is not possible as it can not open any file-handle. So it gets confused and stops the deployed apps.
First solution could be:
Deactivate the scanner so that it only checks once during boot or remove the deployment scanner subsystem and use only CLI to deploy.
Second solution could be:
Increase the file-handler limit (open files size)
java.net.SocketException: Too many open files
On Linux you can increase the number of concurrently open files with
ulimit -n 2048
This would allow 2048 open at the same time in the current session. The command should be either inserted in the session configuration (e.g. .bashrc or similar, depends on your used shell) or in the JBoss start script.
To show the current limit you can use
ulimit -n

Glassfish4 execution errors

I have a brand new installation of glassfish4. I added one glassfish server to my list of servers in Eclipse kepler.
I now get the error Unable to start server on time. java.util.concurrent.TimeoutException. In the stack trace, I
see java.net.BindException: Address already in use: bind. I googled the first message and tried to fix it by removing
the osgi folder and replacing a glassfish jar as mentioned here - Unable to find or serve resource
That gave me a new error which said something like antivirus or something else is blocking glassfish. I googled the second
message and got one link which did not help - How do I clear an address for Glassfish 4.0 with default settings?
Finally, I decided to reinstall glassfish4 and try all over again. I get the same error messages again. Now, I don't know what to do. Please help me.
Thanks.

Java EE 7 updatetool installation fails

I have tried to install Java EE 7 with updatetool to be able to run Java EE Tutorial examples.
But the installation of updatetool fails. I have tried to start updatetool installation from the command line on my elementary os, then I saw the error when installing updatetool.
Here is an image: http://oi58.tinypic.com/x6iumx.jpg
Error text example 1:
Input/output error: Connection failed for URL http://pkg.oracle.com/javaeesdk/7/native/release/manifest/0/updatetool#2.3.5%2C0-56.2852%3A20111207T211721Z: 503: Service Temporarily Unavailable
Could not download application packages. This could be because:
- a proxy server is needed to access the internet. Please ensure that
the system proxy server settings are correct, or set the 'http_proxy'
environment variable to the full URL of the proxy server.
- the package server or network connection is slow.
If you are getting time out errors you can try setting the
PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT
environment variables and try again. For example to increase
the timeouts to 300 seconds set them to 300
- the package server is down or otherwise inaccessible or it is
generating invalid data. Please contact the provider of the package
server.
Error text example 2:
File 138/564 Input/output error: Connection failed for URL http: //pkg.oracle.com/javaeesdk/7/native/release/file/0/217e83782a91f09fa7f35122412cd155263b107f: 502: Proxy Error
Could not download application packages. This could be because:
- a proxy server is needed to access the internet. Please ensure that
the system proxy server settings are correct, or set the 'http_proxy'
environment variable to the full URL of the proxy server.
- the package server or network connection is slow.
If you are getting time out errors you can try setting the
PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT
environment variables and try again. For example to increase
the timeouts to 300 seconds set them to 300
- the package server is down or otherwise inaccessible or it is
generating invalid data. Please contact the provider of the package
server.
I don't use any proxy server. Help please!
I had the same - it's because their site is so unbelievably slow.
The output you showed tells you what to do, increase the timeout.
But sometimes it just needs to be run again, which worked in my case.
You can download the tutorial from Oracle Java EE 7 SDK download page.
Just download the latest Java EE 7 SDK, and unzip. The tutorial is inside the glassfish4/docs folder.
I have managed to install updatetool finally, after 3 days.
My advice for everyone who has the same problem:
Try installation several times in the morning, afternoon, evening and at night. And maybe once you will have successful attempt :)
The problem was not on my side.

Error commiting response java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.write0(Native Method)

I encounter this error after a number of https requests. Anyone have any idea what could be the reason? It seens to be related to SSL. But previously it was working fine. I really don't understand what could have caused this issue
Error commiting responsejava.io.IOException: Broken pipe at
sun.nio.ch.FileDispatcher.write0(Native Method) at
sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29) at
sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104) at
sun.nio.ch.IOUtil.write(IOUtil.java:75) at
sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302) at
com.sun.enterprise.server.ss.ASOutputStream.write(ASOutputStream.java:120) at
com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:283) at
com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:272) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:666) at
com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59) at
org.apache.coyote.http11.InternalOutputBuffer.commit(InternalOutputBuffer.java:602) at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.action(ProcessorTask.java:721) at
org.apache.coyote.Response.action(Response.java:188) at
org.apache.coyote.Response.sendHeaders(Response.java:380) at
org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:357) at
org.apache.coyote.tomcat5.OutputBuffer.close(OutputBuffer.java:318) at
org.apache.coyote.tomcat5.CoyoteResponse.finishResponse(CoyoteResponse.java:528) at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:192) at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604) at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475) at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:426) at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281) at
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83
I don't know about sun.nio.ch. but...
This is a standard annoying error you get sometimes in Java web apps. You get this error when requesting a URL and then either hitting stop in your browser or clicking away to another url. The app is complaining that it wasn't able to send you the complete response.
In my case this was happening when I generated an Excel or csv file on the server for local download (crash at HttpServletResponse getOutputStream().flush())
However it is related to the browser configuration, in my case Chrome 32 bits on Windows 7. Nothing on server side.
For 3 days I've investigated in depth my web application, looking for the cause of the problem, checked many apache librairies etc.
Then I tried to perform the same action from an another computer and finally from the same one with FireFox. No problem.
Finally I discovered that the cause was Chrome’s default Cache Size.
I changed it with -disk-cache-size-2147483648 (at the end of the shortcut's target) and problem disappeared.
I hope it can save time to someone.
A Java NIO Pipe is a one-way data connection between two threads. A Pipe has a source channel and a sink channel. You write data to the sink channel. This data can then be read from the source channel.
Now coming to the problem. Whenever sink channel is FULL (reads are NOT fast enough to leave some space in the buffer ), pipe is closed!!
So any writes coming after this point will fail.

Categories

Resources