Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By SurfMan

Thread: sun.net.ftp.FtpLoginException: Not logged in

  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,037
    Rep Power
    8

    Default sun.net.ftp.FtpLoginException: Not logged in

    Tell me please what is wrong with this simple code:

    FTP is open ftp://willemii.orgfree.com:FTP_PASSW...ages/principal
    sun.net.ftp.FtpLoginException: Not logged in
    FTP did not work out
    at sun.net.ftp.FtpClient.readReply(FtpClient.java:231 )
    at sun.net.ftp.FtpClient.issueCommand(FtpClient.java: 193)
    at sun.net.ftp.FtpClient.login(FtpClient.java:516)
    at sun.net.http://www.protocol.ftp.FtpURLConnec...tion.java:276)
    at sun.net.http://www.protocol.ftp.FtpURLConnec...tion.java:352)
    at slideshowapplet.Main.readFileList(Main.java:47)
    at slideshowapplet.Main.<init>(Main.java:28)
    at slideshowapplet.Main.main(Main.java:32)

    so here is the main part:
    Java Code:
    private boolean readFileList() {
    	BufferedReader in = null;
            java.net.URLConnection con = null;
    	try{
    		URL url = new URL(WEBSITE_FTP + File.separator + "tryoutwebsite" +
                         File.separator + "slideshowImages" +
                        File.separator + "principal");
    		con = url.openConnection();
                    System.out.println(" FTP is open " + url);
    		in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    		String line = in.readLine();
                    System.out.println(" buffered reader initialized ");
    		while(line!=null) {
    			String res = parseLine(line);
    			if(res!=null)
    			{
    				fileList.add(res.trim());
    			}
    			line = in.readLine();
    		}
    		in.close();
    		return true;
    	}catch(Exception ex){
                ex.printStackTrace();
                System.out.println(" FTP did not work out ");
            }
    	return false;
    }
    
        private String parseLine(String line) {
    	System.out.println(" --> " + line);
            return line;

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,037
    Rep Power
    8

    Default Re: sun.net.ftp.FtpLoginException: Not logged in

    There is very little un the net concerning this error
    so I have no clue what is saying.....

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    729
    Rep Power
    2

    Default Re: sun.net.ftp.FtpLoginException: Not logged in

    Using java.net.URLConnection is only suitable for a quick download of a file. Getting a directory listing involves a bit more work which cannot be done using URLConnection. Try using the Apache Commons Net, which also has an FTP client. Example code here.
    Fubarable likes this.

  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,037
    Rep Power
    8

    Default Re: sun.net.ftp.FtpLoginException: Not logged in

    Great stuff surfman, I look into it
    saludos willem

Similar Threads

  1. Save logged in user
    By Skipito in forum New To Java
    Replies: 4
    Last Post: 12-06-2011, 11:38 AM
  2. Get list of users logged on to database
    By Happyme in forum New To Java
    Replies: 0
    Last Post: 06-14-2011, 01:37 PM
  3. Getting logged in user's password.
    By cool in forum AWT / Swing
    Replies: 2
    Last Post: 11-03-2010, 06:42 AM
  4. log4j - capturing logged events
    By Katanagas in forum Advanced Java
    Replies: 2
    Last Post: 10-25-2010, 02:07 PM
  5. Error logged from JDT Debug UI Window
    By tsc in forum Eclipse
    Replies: 1
    Last Post: 07-10-2008, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •