This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201449 - [JDK 7] FTP does not work with Java 7
Summary: [JDK 7] FTP does not work with Java 7
Status: RESOLVED WONTFIX
Alias: None
Product: php
Classification: Unclassified
Component: FTP Support (show other bugs)
Version: 7.0
Hardware: All Windows 7
: P2 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords: RELNOTE
Depends on:
Blocks:
 
Reported: 2011-08-30 16:17 UTC by giank
Modified: 2014-02-16 11:23 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 180723


Attachments
stacktrace (1.30 KB, text/plain)
2011-08-30 16:17 UTC, giank
Details

Note You need to log in before you can comment on or make changes to this bug.
Description giank 2011-08-30 16:17:49 UTC
Build: NetBeans IDE Dev (Build 201108290601)
VM: Java HotSpot(TM) Client VM, 21.0-b17, Java(TM) SE Runtime Environment, 1.7.0-b147
OS: Windows 7

User Comments:
GUEST: I was trying to upload a file on a webserver.

I know that it works because I AM NOW UPLOADING THE FILE WITH FILEZILLA, while netbeans doesn't want to upload them.

passive mode is on, but I can see that stupid netbeans is also trying to cd the directories via //directory although I removed the /.

I guess eclipse is the way to go!

giank: Unable to upload a file on a server. The problem appears with Netbeans 7.0.1 so I tried with the last dev. 

(note that file name has been edited out)

INFO [org.netbeans.modules.php.project.copysupport.RemoteOperationFactory]: Upload failed: org.netbeans.modules.php.project.connections.TransferInfo [transfered: [], failed: {[FILENAME]=Cannot upload file [FILENAME] (unknown reason).}, partially failed: {}, ignored: {}, runtime: 218 ms] 
INFO [org.netbeans.modules.php.project.copysupport.CopySupport]: REMOTE copying fail: 
java.net.SocketException: Software caused connection abort: socket write error 

For a forum discussion, refer to
http://forums.netbeans.org/post-112747.html

A forum member reported that downgrading JDK to 1.6.27 solved for him.




Stacktrace: 
java.net.SocketException: Connection reset by peer: socket write error
   at java.net.SocketOutputStream.socketWrite0(SocketOutputStream.java:0)
   at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
   at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
   at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
   at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
   at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
Comment 1 giank 2011-08-30 16:17:53 UTC
Created attachment 110284 [details]
stacktrace
Comment 2 giank 2011-08-30 17:22:48 UTC
I can confirm myself that downgrading to Java SE Development Kit 6 Update 27 made this specific problem go away.
Comment 3 Tomas Mysik 2011-08-31 09:07:28 UTC
Vlado, could you please try to reproduce? It seems that all the reports comes from Windows 7 and JDK 7.

Guys, couldn't it be a firewall issue?
Comment 4 giank 2011-08-31 10:29:38 UTC
I can assure it is not a firewall issue; other FTP programs work as expected, deactivating Windows Firewall has no effect, downgrading JDK solves the problem. 

It seems to be an incompatibility between the JDK newer socket functions and netbeans under certain circumstances (at least under Windows 7 64 bit). The link in the first messages has some users reporting that even plugin catalog doesn't seem to properly work (albeit I didn't try it, it works for me now with the downgrade).
Comment 5 Vladimir Riha 2011-09-01 08:51:32 UTC
Sure, I'll try to reproduce it later today on Win7 64b & JDK7 32/64b
Comment 6 Tomas Mysik 2011-09-01 09:06:06 UTC
Also, please watch the IDE log for connection errors related to the Update Center.

Thanks.
Comment 7 Vladimir Riha 2011-09-01 17:14:25 UTC
So right now I can't reproduce it due to issue #201197, so I'll try it tomorrow again with build containing fix for the mentioned bug.
Comment 8 Tomas Mysik 2011-09-02 04:25:56 UTC
(In reply to comment #7)
> So right now I can't reproduce it due to issue #201197

Easy to avoid, just start NB with "-J-da" (disable assertions).
Comment 9 Tomas Mysik 2011-09-06 09:58:39 UTC
Reassigning to Lada, please test it and then reassign back.

Thanks.
Comment 10 Tomas Mysik 2011-09-06 10:02:21 UTC
Lado, please try also updating of your IDE so we can see whether the problem is in the FTP library or in networking in general.

Thanks.
Comment 11 Vladimir Riha 2011-09-06 12:16:54 UTC
Reassigning back.

I was able to reproduce it (I believe it's the same problem): I tried to create new php project from remote sources (FileZilla FTP server on localhost). During the project creation, after adding all credentials etc. and setting up FTP connection I pressed Next and proceed to the step where all files/folders from FTP are supposed to be shown and I can check what files to download. 

However, no files were displayed, I got the message "No files available, navigate back and verify...". I let it in this state for some time (1-3 minutes) and after that the 

    java.net.SocketException: Connection reset by peer: socket write error

exception popped up. The IDE log seems to be identical to giank's log. I'm able to connect to update center...


Here is a output from window "Output - remote logs":
...
331 Password required for newuser
PASS ******
230 Logged on
TYPE I
200 Type set to I
CWD /PhpProject1
250 CWD successful. "/PhpProject1" is current directory.
CWD /PhpProject1
250 CWD successful. "/PhpProject1" is current directory.
PWD
257 "/PhpProject1" is current directory.
SYST
215 UNIX emulated by FileZilla


Product Version: NetBeans IDE Dev (Build 201109040600)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 12 Tomas Mysik 2011-09-06 13:22:07 UTC
Personally, I cannot reproduce on Linux.

Could anyone of you try to increase the "Keep-Alive Interval" to a big number (let's say 9999) and try it? Does it help or not?

Meanwhile, I will try to reproduce on WinXP.

Thanks.
Comment 13 Vladimir Riha 2011-09-06 14:13:45 UTC
I found out that the problem was the buil-in firewall in Win7 after all. I have clean installation of Win7 with no "custom" firewall. With default settings, I had the problem described in comment #11 (and quite possible the same as the reporter). I tried to turn off the Windows7 firewall and it all start to work. 

So please, double check that the Windows firewall is disabled. It's interesting that actions like "Test connection" or Plugin Catalog work with the enabled firewall.

I'll check behavior on JDK6 ASAP
Comment 14 Vladimir Riha 2011-09-06 14:24:59 UTC
Update: 
As promised, I tried the same with NetBeans on JDK6_u27 and the Windows7 firewall didn't block it. So the firewall makes difference between JDK6 and JDK7 and blocks the new version for some reason.
Comment 15 tjrush 2011-09-07 20:04:04 UTC
This problem does not seem to be limited to Win 7. I am using Vista 32 and and ftp fails after upgrading to Java 7.
Comment 16 Tomas Mysik 2011-09-08 04:33:29 UTC
(In reply to comment #15)
> This problem does not seem to be limited to Win 7. I am using Vista 32 and and
> ftp fails after upgrading to Java 7.

And if you disable the Windows built-in firewall, does it work?

Thanks.
Comment 17 Tomas Mysik 2011-09-08 04:45:49 UTC
The same problem found here [1] with steps how to solve it. And one more post [2] on stackoverflow.com.

[1] http://www.enterprisedt.com/forums/viewtopic.php?p=10700
[2] http://stackoverflow.com/questions/6990663/java-7-prevents-ftp-transfers-on-windows-vista-and-7-if-firewall-is-on-any-ideas
Comment 18 giank 2011-09-08 04:57:08 UTC
As correctly pointed out, this bug doesn't seem to reside in Netbeans per se, but in Java 7.

I propose to add a message in the installer or at the first launch to add the exception in the firewall for java.exe, as the bug [1] in the Oracle database is currently set as low priority and also because third party firewall software could also not trigger the appearance the exception rule wizard window.

[1] "java.net.Socket closes when "PASV" is sent on an authenticated FTP connection" http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696
Comment 19 Tomas Mysik 2011-09-08 05:21:25 UTC
Closing this issue again (perhaps WONTFIX is better since it is a bug but NetBeans PHP support really cannot do anything to solve/work around it) and reporting a new issue #201790, feel free to post your comments there.

Thanks.
Comment 20 Vladimir Riha 2011-09-12 10:16:08 UTC
SFTP seems to work just fine with Windows firewall turned on and off.
Comment 21 Tomas Mysik 2011-09-12 13:49:19 UTC
For Jeff:

Please, add a note to the Release Notes that users with Windows Vista or Windows 7 should check their Windows firewall if FTP does not work for them (connection to a remote server is OK but some operations fail). For more information, please, read this issue.

Thanks.

BTW I will add a warning to the NetBeans itself, see issue #202021.
Comment 22 Tomas Mysik 2011-09-12 13:51:40 UTC
Choosing a bit better Platform.
Comment 23 Jeffrey Rubinoff 2011-09-12 21:23:14 UTC
I've added the following warning to the FTP tutorial:

JDK 7 + Windows 7/Vista: Windows 7 and Windows Vista firewall blocks some (S)FTP operations that are launched by JDK 7. See NetBeans Issue 201449 for details. One suggested workaround is to open your Windows Firewall settings and add exceptions for both JDK and JRE java.exe and javaw.exe files.

I'm writing Alyona Stashkova under separate cover with
Comment 24 Jeffrey Rubinoff 2011-09-12 21:38:24 UTC
Sorry, lost part of comment there.
Alyona, I'd suggest the following rel note, for both 7.0.1 and 7.1:
Known Issues: PHP
Known Issues: Mobility
Issue 201449: [JDK 7] FTP does not work with Java 7 on Windows 7 or Vista.
Description: Windows 7 or Windows Vista users running NetBeans IDE on JDK 7 may experience FTP communication failure.
Workaround: Check Windows Firewall. Windows Firewall blocks some FTP operations launched by JDK 7. Try adding JDK and JRE java.exe and javaw.exe files to Windows Firewall's Exclusions list.
Comment 25 Tomas Mysik 2011-09-13 08:19:59 UTC
Thanks a lot, Jeff. Just one minor note - it seems (based on comment #20) that SFTP works without any problems. This issue affects only FTP.

Thanks.
Comment 26 AlyonaStashkova 2011-09-13 13:44:35 UTC
Added to Release Notes for NB 7.0.1 (http://netbeans.org/community/releases/70/relnotes.html#201449)
Comment 27 _jay 2011-10-17 04:25:53 UTC
Workaround from the release notes did not work.  

Used solution from the netbeans forums: 
http://forums.netbeans.org/post-115176.html#115176
Comment 28 AlyonaStashkova 2011-10-17 16:07:33 UTC
Updated the workaround in the Release Notes
(http://netbeans.org/community/releases/70/relnotes.html#201449).
Comment 29 neonshark 2011-12-21 05:35:14 UTC
(In reply to comment #20)
> SFTP seems to work just fine with Windows firewall turned on and off.

No, SFTP also doesn't work on Win 7 with Java7.
Comment 30 timbergus 2011-12-27 16:28:32 UTC
Hi all. This is my configuration, and the FTP connection still doesn't work with and without Windows firewall working.

Windows 7 x32 bits
NetBeans 7.1 RC2
JDK 7u2

I have even test FTP and Secure FTP. The funny thing is that when I tried the connection the first time, Windows firewall advise me about NetBeans trying to connect, and I authorize all the connections. This is what I have obtained from NetBeans. Is this the same problem of everybody?


220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 12 of 75 allowed.
220-Local time is now 10:48. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 2 minutes of inactivity.
USER ****
331 User **** OK. Password required
PASS ******
230 OK. Current restricted directory is /
TYPE I
200 TYPE is now 8-bit binary
CWD /public_html
250 OK. Current directory is /public_html
PWD
257 "/public_html" is your current location
CWD /public_html
250 OK. Current directory is /public_html
PORT 161,111,120,60,194,248
200 PORT command successful
STOR texts.php.new
150 Connecting to port 49912
DELE texts.php.new
226-Error during write to file
226 Transfer aborted
QUIT
250 Deleted texts.php.new
Comment 31 Tomas Mysik 2012-01-02 08:59:45 UTC
This one is really WONTFIX, please, do not change.

@timbergus: You problem could be caused by TLS - please, try to check "Encrypt Only Authentication Process" in your Remote (FTP) configuration.
Comment 32 timbergus 2012-01-02 09:07:48 UTC
(In reply to comment #31)
> This one is really WONTFIX, please, do not change.
> 
> @timbergus: You problem could be caused by TLS - please, try to check "Encrypt
> Only Authentication Process" in your Remote (FTP) configuration.

OK. Sorry, and thank you very much for your answer. I will check my configuration.
Comment 33 ohmayk 2012-02-21 16:31:29 UTC
For WINDOWS 7 
The problem is caused by the stateful FTP filter of the firewall. As a workaround you can disable it by executing this:
"netsh advfirewall set global StatefulFTP disable"
with administrator rights
Comment 34 xympa 2012-06-07 14:14:35 UTC
I confirm that this solved the issue on my platform.

-> Product Version: NetBeans IDE 7.1.2 (Build 201204101705)
   Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
   System: Windows 7 version 6.1 running on amd64; Cp1252; pt_PT (nb)

(In reply to comment #33)
> For WINDOWS 7 
> The problem is caused by the stateful FTP filter of the firewall. As a
> workaround you can disable it by executing this:
> "netsh advfirewall set global StatefulFTP disable"
> with administrator rights
Comment 35 Spidermind 2012-06-12 20:12:32 UTC
!Important

I had the same error and problem and TURNING OFF THE FIREWALL solve it. Upload works with no problem. I'm using a free host from 000webhost.

Error: Upload failed: org.netbeans.modules.php.project.connections.transfer.TransferInfo [transfered: [], failed: {LocalTransferFile[name: home_view.php, remotePath: application/views/home_view.php, baseLocalDirectoryPath: C:\Program Files\Ampps\www\MLM, baseRemoteDirectoryPath: /public_html, hasParent: false, isFile: true, isDirectory: false, isLink: false]=Cannot upload file home_view.php (unknown reason).}, partially failed: {}, ignored: {}, runtime: 175 ms]
Comment 36 mago_ebon 2012-07-09 18:31:05 UTC
On command line and running as administrator, enter:

netsh advfirewall set global StatefulFTP disable

Taken from:
http://blog.ldronline.dk/2011/how-to-fix-ftp-upload-using-netbeans-7-and-jdk-7/
Comment 37 AlyonaStashkova 2012-07-19 13:02:03 UTC
(In reply to comment #36)
> On command line and running as administrator, enter:
> 
> netsh advfirewall set global StatefulFTP disable
> 
> Taken from:
> http://blog.ldronline.dk/2011/how-to-fix-ftp-upload-using-netbeans-7-and-jdk-7/

There's NetBeans Configuring Windows Firewall For Passive FTP User FAQ available at http://wiki.netbeans.org/FAQConfiguringWinFirewallForPassiveFTP
Comment 38 mikeklon 2013-01-03 21:25:36 UTC
Hello and good afternoon.

I'm using NetBeans 7.2 on Mac OS X Snow Leopard.  I'm experiencing the same problem.  Can't upload to remote host.  I'll post the Output screen below.  FTP connection tests OK during setup.  I am able to upload using other FTP clients.

What is the solution for Mac?  Thank you in advance for any help.

Output window:

220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 17 of 500 allowed.
220-Local time is now 13:58. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
USER teet5863
331 User teet5863 OK. Password required
PASS ******
230 OK. Current restricted directory is /
TYPE I
200 TYPE is now 8-bit binary
CWD /ahs74test
250 OK. Current directory is /ahs74test
PWD
257 "/ahs74test" is your current location
CWD /ahs74test
250 OK. Current directory is /ahs74test
PORT 192,168,1,5,195,32
200 PORT command successful
STOR index.php.new
NOOP
QUIT
Keep-alive failed for server www.mikeklonecki.com (unknown reason).

Summary
====================
Failed:
file      index.php     Cannot upload file index.php (unknown reason).
Runtime: 90 s, processed: 0 file(s), 0 KB
Comment 39 Tomas Mysik 2013-01-04 05:51:32 UTC
(In reply to comment #38)
> I'm using NetBeans 7.2 on Mac OS X Snow Leopard.  I'm experiencing the same
> problem.

Please, report a new issue. It likely is another issue, moreover it can be easily marked as a duplicate of this one.

Thanks.
Comment 40 Jackie_Rosen 2014-02-16 11:23:23 UTC
SPAM - Removed by Administrator