I am using com.enterprisedt.net.ftp.FTPClient to login my FTPSERVER
using the following command ftpClient.login(USER_NAME,PASSWORD());
am using com.enterprisedt.net.ftp.
But some times am getting "Not logged in" error.
FTP server has a domain name. but i log in only with user name and pwd and host name as the dns name.
In some 10, 15 , 20 minutes I get a "not logged in" error.
It is not occuring always, not in any specific pattern also, but immedietly after the error the connection is succesful.
[INFO] [FTPPull : getFTPConnection] - Error occured while FTP login : Not logged in The host is xxx.yyy.in The port used is 6370 [12] [2011-11-10 14:59:18 CET ]
but next connection was succesful
[INFO] [FTPPull : getFTPConnection] - Login Successful [12] [2011-11-10 15:09:18 CET ]
Please help, not sure why sometimes getting connected and sometimes not connected.
Regards,
Sridevi
Your problem is probably that there is a timeout at the FTP command channel level. When your client detects it, it reconnects automatically, as you have witnessed.
Now, you have to understand where that timeout comes from: either the client side or the server side:
first check the configuration on the server side: can you change the command channel timeout to a higher value, or even to infinite?
then check the API for your client (I personally use Apache Commons' FTP client): does it have a way to set the timeout too?
finally, check in the API whether sockets to the command channel use TCP keepalive; if not, does it have a method to set it? If you pass a Socket yourself to the constructor, make it keepalive before constructing your client instance.
The most likely scenario is however that the FTP server itself closes the command channel. Changing that is implementation dependent.
A good way to check the server side disconnection is to use a command line FTP client to check. I personally use lftp for that:
$ lftp ftp://some.ftp.site/
lftp> debug
# idle, idle...
# if the server times out, it will tell you so
Related
I am getting the below given error while performing ftp from ubuntu machine to same machine. I have done the complete setup and able to transfer file using Filezilla. But while doing the same from code it is giving error. Below I have shown the code snippet.
String PROTOCOL= "SSL"; //I Have tried with TLS also
FTPSClient ftpsClient = new FTPSClient(PROTOCOL, false);
ftpsClient.setTrustManager(TrustManagerUtils.getAcceptAllTrustManager());
ftpsClient.connect("192.168.13.5",21);
ftpsClient.login(userName, password);
I am getting the error 530 Please login with USER and PASS. While connecting only. It is not even going to login statement.
Can somebody please point me out what I am doing wrong here?
I am getting the error 530 Please login with USER and PASS. While connecting only. It is not even going to login statement.
If it is not even going to the login statement the message might be caused by the server rejecting the AUTH TLS command which is used to upgrade the connection to SSL/TLS. This might indicate that the server does not support TLS at all.
... able to transfer file using Filezilla.
Are you sure that Filezilla did use FTP with TLS and not plain FTP or SFTP (which is file transfer using SSH, something completely different to FTPS)?
I'm not quite sure, but when you're saying you're using the server and the Client on one machine, you have to use localhost 127.0.0.1 as IP Adress
I am using linux box.
I am unable do any operation using IPv6 FTP server.I am able to connect using IPV6 FTP server.
But when I will do any operation(like ls,get,put ..) it's giving below exception(Highlighted with bold).
[root#SKP-vlnx ~]# ftp aa01:9:1::22:56ff:231:4b
Connected to aa01:9:1::22:56ff:231:4b (aa01:9:1::22:56ff:231:4b ).
220 Service ready for new user
Name (aa01:9:1::22:56ff:231:4b ): xyz
331 User name okay, need password for ftp-user
Password:
230 User logged in, proceed
Remote system type is UNIX.
ftp> ls
502 Command EPSV not implemented
502 Command LPSV not implemented
Passive mode refused.
Any body please help on this.
This means, that the server either does not implement the necessary commands for IPv6 passive mode, which are different from the old IPv4 passive mode (new EPSV, old PASV). This might be either because the server is not really IPv6 ready or because it does not implement passive mode at all.
You might try to use active mode. But, if the server is not really IPv6 ready you will run into the same problem because this also requires a new command for IPv6 (EPRT instead of PORT).
I try to connect to a wss (Secure Websocket) server with a java applet but the ssl handshake fails without any helpfull log entrys.
If I connect to wss://echo.websocket.org the handshake works fine, so I think it's not a general java code error.
If I try to connect to my own server, the HelloDone bit is sent (verified by wireshark) but the connections ends in a hang-up and it's not in the log. Normally there should be the following message in the log: "*** ServerHelloDone"
See my java console log of "javax.net.debug=sll"
http://pastebin.com/ZuvKww4J
It is not truncated, it simply ends there.
After a couple of seconds the tcp connection timeout message is added to the log.
I use the following example of java code:
https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/SSLClientExample.java
But instead of keystore I use:
sslContext.init( null, null, null );
For the server I have two different test systems:
At port 443 a ha-proxy
at port 8443 a stunnel.
I tried to isolate the error with different methods. First I forced with stunnel the same cipher as echo.websocket.org "SSL_RSA_WITH_RC4_128_SHA" but no success.
Second I checked if the ssl certificate itself is still valid. But as web browser and normal https connection by my java applet, are accepted from the server (Same server. ha-proxy orstunnel) everything is working at that point to.
Problem was solved by maintainer of Java-WebSocket.
Big thans
I am using JavaMail to connect to a POP3 server.
Further, I set the following properties, so that JavaMail won't wait to long if an email server doesn't respond:
props.setProperty("mail.pop3.connectionpooltimeout", "3000");
props.setProperty("mail.pop3.connectiontimeout", "3000");
props.setProperty("mail.pop3.timeout", "3000");
However, in some cases the timeout works properly but sometimes JavaMail freezes for minutes(!) with the following debug message:
DEBUG POP3: connecting to host "pop3.yahoo.com", port 110, isSSL false
Changing ports or protocols (SSL, TLS..) has no effect. I assume that the host simply doesn't exist.
For example, if I poll pop3.yahoo.com instead of pop.mail.yahoo.com (which would be the right host name), I have to wait very long til a timeout exception occurs.
After several minutes, I get the following exception and the application continues to run:
java.net.ConnectException: Operation timed out
pop3.yahoo.com seems to exist but won't respond:
localhost:~ me$ ping pop3.yahoo.com
PING pop3.yahoo.com (206.190.46.10): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
^C
You might be asking why I use pop3.yahoo.com instead of pop.mail.yahoo.com.
Well, I simply wanted to test what happens if the user of my application inserts a wrong host name.
I believe that this issue is related to this report http://www.opensubscriber.com/message/javamail-interest#java.sun.com/180946.html where the poster claims that the problem occurs if the email server closes the connection. JavaMail then seems to wait very long (don't know why).
Since the issue wasn't resolved in the link I posted: Does somebody know how to fix or at least debug this?
Any help would be really appreciated!
I found the reason for the problem. It was a bug in my code. Javamail respects the timeout setting fine.
Most likely, yahoo is silently dropping all packets directed at that host. This is a tad annoying, because otherwise you'd immediately get back host unreachable or connection refused, which would be much easier to handle. Everything looks correct though, assuming you're using POP3 and not POP3S.
I see from the API that you can provide your own SocketFactory. Doing that you'd have greater control over the socket parameters, and you can test whether the socket is really being created correctly by JavaMail (if setting the SocketFactory property doesn't work, you know that's where to look). If all else fails, you could set up an extra thread that sets a timeout and interrupts the JavaMail thread when it expires. This is all workaround stuff of course.
It would also be helpful to check with netstat what state the connection is in. If it's going to timeout it should be in SYN_SENT.
I'm hoping to get some help with this weird problem. We're running the Jacorb name server and I have a simple client that I'm using to try to connect and do awesome CORBA voodoo. The name server is running, but when I try to start my java app, I get a "Connection failure" error (org.omg.CORBA.COMM_FAILURE, minor code 201, "caused by java.net.ConnectionException: Connection refused: connect").
Here's the weird part. The error reports that it's trying to connect using the default port 900, but I'm passing in an argument to try to override the port number of the name service to match the one being used by the name server. My java command is like this:
java -classpath . HelloClient -Djava.endorsed.dirs="bla bla bla" <br>
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
-DORBInitRef.NameService=corbaloc::localhost:2809/StandardNS/NameServer-POA/_root
I also tried the parameters without the first capital D (I've seen it both ways and I don't know the difference).
Now, if I put in -ORBInitialPort 2809, then the client does appear to try to connect, but then I get a corba.OBJECT_NOT_EXIST error.
I could use any help or advice anyone has.
Connection Refused. This sounds like a firewall/program not running issue.
try a telnet <machine> 2809. You should get a "Connected to "
and not a refusal, if everything is running/enabled correctly.
I'm running on a UNIX client so the paths use UNIX style.
jacORB installed properly ? e.g. get the nameservice entry from the
orb.properties file (in ${JAVA_HOME}/jre/lib/
I use "ORBInitRef.NameService=corbaloc::localhost:2809/NameServer"
as "NameServer" is used on the production name server and not the other
string of "Standard...."
The other changes in the properties files are setting the paths to UNIX
style (i.e. e:\NS_Ref -> /tmp/NS_Ref)
jacorb.naming.ior_filename=/tmp/NS_Ref
1a. Setting the http:// in the properties file didn't seem to do anything
in regards to resolving on the client side.
1b. NOTE: start ns with:
ns -DOAPort=2809
Log will show:
2010-05-27 10:00:47.777 FINE Created socket listener on 0.0.0.0/0.0.0.0:2809
2010-05-27 10:00:47.777 FINE Using port 2809
Running:
$ lsof | grep 2809
java 27529 jbsymolo 15u IPv6 693300 TCP *:2809 (LISTEN)
$ lsof -Pnl +M -i6
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Naming_Se 9678 1000 7u IPv6 45779 TCP *:51148 (LISTEN)
java 27959 1000 15u IPv6 696092 TCP *:2809 (LISTEN)
Not Running: (shows nothing)
ns when started will log where it reads the properties from and it shouldn't
throw any errors. If it does your properties files have issues.
VM arguments. The -D is used to set system properties. Any Java code can
then access any property so defined via System.getProperty(). Even though
I've also seen the "non-D" used, I've been using the D.
-DORBInitRef.NameService=corbaloc::localhost:2809/NameService
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
When running the client in Eclipse, I see the following in the Console:
May 27, 2010 10:01:06 AM org.jacorb.config.JacORBConfiguration init
INFO: base configuration loaded from file /usr/lib/java/jdk1.6.0_18/jre/lib/orb.properties
...
2010-05-27 10:01:09.836 FINE Trying to connect to 127.0.0.1:2809 with timeout=90000.
2010-05-27 10:01:09.844 INFO Connected to 127.0.0.1:2809 from local port 45745
2010-05-27 10:01:09.846 FINE wrote 12 bytes to 127.0.0.1:2809
...
Skipping lots of other read/write traffic
I can't be sure without seeing the rest of the code, but I'm pretty sure you need to change the InitRef string to be:
-DORBInitRef.NameService=corbaloc::localhost:2809
When your client connects, this should give you the root naming context for the naming service and then you can traverse the NameContext tree to get to your desired server object.