You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "jones wen (JIRA)" <ji...@apache.org> on 2010/12/17 06:23:01 UTC

[jira] Created: (NET-347) FTPClient.listFiles throw exception when connect to an IPv6 FTP server

FTPClient.listFiles throw exception when connect to an IPv6 FTP server
----------------------------------------------------------------------

                 Key: NET-347
                 URL: https://issues.apache.org/jira/browse/NET-347
             Project: Commons Net
          Issue Type: Test
          Components: FTP
         Environment: jdk 1.6, commons-net-2.2.jar
            Reporter: jones wen


If i setup the IPv6 FTP server on localhost, it is OK.
If the IPv6 FTP server is on saloris 10(external host), FTPClient.listFiles() will throw below exception,
java.net.BindException: Cannot assign requested address: JVM_Bind
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.PlainSocketImpl.bind(Unknown Source)
	at java.net.ServerSocket.bind(Unknown Source)
	at java.net.ServerSocket.<init>(Unknown Source)
	at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:515)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2545)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2519)
	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2276)
	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2322)
	at FtpTest.main(FtpTest.java:29)


the test code is,

    	FTPClient client = new FTPClient();
    	try {
			client.connect(Inet6Address.getByName("2010::214:4fff:fe4d:2c4b"), 21);
			client.login("abc", "abc");

			client.enterLocalActiveMode();
			client.setActiveExternalIPAddress("2010::214:4fff:fe4d:2c4b");
			
			FTPFile[] list = client.listFiles();
                        if(list != null && list.length > 0) {
				for(int i=0; i<list.length; i++) {
					System.out.println(list[i].getName());
				}

			}
		} catch (SocketException e) {
			e.printStackTrace();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (NET-347) FTPClient.listFiles throw exception when connect to an IPv6 FTP server

Posted by "Bogdan Drozdowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991410#comment-12991410 ] 

Bogdan Drozdowski commented on NET-347:
---------------------------------------

Is this the code that isn't working? The given code tries to bind to the address of the server. The address to bind to must be one of the local addresses, not a remote address. If not using NAT, don't set the active external IP address or set it to :: (to force IPv6 addressing). If using a NAT, set it to the external address of the gateway.

> FTPClient.listFiles throw exception when connect to an IPv6 FTP server
> ----------------------------------------------------------------------
>
>                 Key: NET-347
>                 URL: https://issues.apache.org/jira/browse/NET-347
>             Project: Commons Net
>          Issue Type: Test
>          Components: FTP
>         Environment: jdk 1.6, commons-net-2.2.jar
>            Reporter: jones wen
>
> If i setup the IPv6 FTP server on localhost, it is OK.
> If the IPv6 FTP server is on saloris 10(external host), FTPClient.listFiles() will throw below exception,
> java.net.BindException: Cannot assign requested address: JVM_Bind
> 	at java.net.PlainSocketImpl.socketBind(Native Method)
> 	at java.net.PlainSocketImpl.bind(Unknown Source)
> 	at java.net.ServerSocket.bind(Unknown Source)
> 	at java.net.ServerSocket.<init>(Unknown Source)
> 	at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:515)
> 	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2545)
> 	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2519)
> 	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2276)
> 	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2322)
> 	at FtpTest.main(FtpTest.java:29)
> the test code is,
>     	FTPClient client = new FTPClient();
>     	try {
> 			client.connect(Inet6Address.getByName("2010::214:4fff:fe4d:2c4b"), 21);
> 			client.login("abc", "abc");
> 			client.enterLocalActiveMode();
> 			client.setActiveExternalIPAddress("2010::214:4fff:fe4d:2c4b");
> 			
> 			FTPFile[] list = client.listFiles();
>                         if(list != null && list.length > 0) {
> 				for(int i=0; i<list.length; i++) {
> 					System.out.println(list[i].getName());
> 				}
> 			}
> 		} catch (SocketException e) {
> 			e.printStackTrace();
> 		} catch (UnknownHostException e) {
> 			e.printStackTrace();
> 		} catch (IOException e) {
> 			e.printStackTrace();
> 		}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (NET-347) FTPClient.listFiles throw exception when connect to an IPv6 FTP server

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-347.
----------------------

    Resolution: Invalid

Appears to be invalid. 

If the suggested fix does not work, please re-open with new details.

> FTPClient.listFiles throw exception when connect to an IPv6 FTP server
> ----------------------------------------------------------------------
>
>                 Key: NET-347
>                 URL: https://issues.apache.org/jira/browse/NET-347
>             Project: Commons Net
>          Issue Type: Test
>          Components: FTP
>         Environment: jdk 1.6, commons-net-2.2.jar
>            Reporter: jones wen
>
> If i setup the IPv6 FTP server on localhost, it is OK.
> If the IPv6 FTP server is on saloris 10(external host), FTPClient.listFiles() will throw below exception,
> java.net.BindException: Cannot assign requested address: JVM_Bind
> 	at java.net.PlainSocketImpl.socketBind(Native Method)
> 	at java.net.PlainSocketImpl.bind(Unknown Source)
> 	at java.net.ServerSocket.bind(Unknown Source)
> 	at java.net.ServerSocket.<init>(Unknown Source)
> 	at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:515)
> 	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2545)
> 	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2519)
> 	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2276)
> 	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2322)
> 	at FtpTest.main(FtpTest.java:29)
> the test code is,
>     	FTPClient client = new FTPClient();
>     	try {
> 			client.connect(Inet6Address.getByName("2010::214:4fff:fe4d:2c4b"), 21);
> 			client.login("abc", "abc");
> 			client.enterLocalActiveMode();
> 			client.setActiveExternalIPAddress("2010::214:4fff:fe4d:2c4b");
> 			
> 			FTPFile[] list = client.listFiles();
>                         if(list != null && list.length > 0) {
> 				for(int i=0; i<list.length; i++) {
> 					System.out.println(list[i].getName());
> 				}
> 			}
> 		} catch (SocketException e) {
> 			e.printStackTrace();
> 		} catch (UnknownHostException e) {
> 			e.printStackTrace();
> 		} catch (IOException e) {
> 			e.printStackTrace();
> 		}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira