Java 7 - problems with HTTP connections



  • Since installing Netbeans and the Java 1.7 JDK (on my win7 64 machine) Java applications have trouble downloading updates for themselves.

    Minecraft auto updater stopped working, and Eclipse refuses to download the Android plugin (from the help menu, install software, etc...) It runs for a short period, then freezes and does nothing. This goes for Minecraft (downloading the first 1 or 2 megs before freezing) and Eclipse (downloadig package information and component structure, but freezing when downloading the components themselves).

     Is this known behaviour for my setup? Any ideas on resolving this / working around it?

    On a side note, Minecraft worked perfectly on Java 1.6, and Eclipse wasn't installled back then...



  •  It's annoying, but install the 32 bit JDK as well.

     The Android Eclipse plugin works fine after that - I wouldn't be surprised if the other stuff works too.



  • Thanks. I'll try. But the real problem isn't that ADT malfunctions, it's Eclipse refusing to downlaod it in the first place. Anyway, I'll give it a shot.



  • Do you get an error? A timeout? What happens when you start a download?



  •  Make sure you've also installed the SDK first before trying to install the Eclipse plugin.



  • Absolutely nothing happens...

    The first few kilobytes go all right, that's package definitons and such. But after that, it just ... hangs. no errors, n time-outs, no nothing...

    I'll try the 32 bits thingy and let you know if it worked.



  • Ok weird.

    I was thinking that maybe Java wasn't using your proxy settings.



  • OK, tried a lot of different combinations of JRE and JDK, in versions 1.6 and JDK 1.7, 32 or 64 bits versions, all no good.

    When running netstat, I see several TCP connections beloninging to JAVAW as ESTABLISHED, but most TIME_WAIT or CLOSE_WAIT.

    Now I'm no expert on the use of netstat, so anyone see anything weird about this?

    update:

    Now every once in a while, anotherhalf a meg gets downloaded, then the Eclipse 'Install new plugins' freezes with texts like 552kB of 2.2MB at 90.25 kB/s

    So it's sporadically successful at making a connection?... Normal internet and downloading are all at my usual speeds btw...



  • Does anyone actually use Java 7? It was released a year or two ago as I recall, but still everything requires only Java 6 (or even 5) - even the "do you have Java installed?" site points to Java 6!



  • When a friend pointed me to Netbeans (in January), Java 7 hadn't been released yet as current version. However, Netbeans insisted.

    Since then, Java web requests fail (after the first few bytes). Since it still was 'beta' (I guess?...) I figured this bug would be fixed before the final release.

    I tried uninstalling Java 7 and getting the Java 6 JRE/JDK yesterday, and noticed they now push 7 as the main version. 6 has been placed in the archives.


    In other news, I set up a test: wrote a small java program doing 1 web request and writing the response to the stdout. Hangs after reading ~30 kB, crashes with time-out.
    Wrote a small C# app to do exactly the same, works like a charm...



  • Created an Oracle Support Account, submitted a ticket (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7168409) which will become public in a few days, got the JRE and JDK 6u31 from the archives, re-installed the whole she-bang and everything's fine except I'm not running the current version of Java.



  • @steenbergh said:

    Created an Oracle Support Account, submitted a ticket (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7168409) which will become public in a few days, got the JRE and JDK 6u31 from the archives, re-installed the whole she-bang and everything's fine except I'm not running the current version of Java.

    Could you please post sample code? I want to test this out.



  • This code is also included in the ticket:

    ---------- BEGIN SOURCE ----------
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.*;
    
    
    public class HTTPTester {
    
    	public static void main(String[] args) {
    		
    		try {
    			print("** Prepping");
    		    // Construct data
    		    String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
    		    data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
    		    
    		    print("** Sending");
    		    // Send data
    		    URL url = new URL("http://www.nu.nl/");
    		    URLConnection conn = url.openConnection();
    		    conn.setDoOutput(true);
    		    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    		    wr.write(data);
    		    wr.flush();
    
    		    print("** Receiving");
    		    // Get the response
    		    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    		    String line;
    		    while ((line = rd.readLine()) != null) {
    		        System.out.println(line);
    		    }
    		    wr.close();
    		    rd.close();
    		    print("** Done");
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		
    
    	}
    	
    	private static void print(String s) { System.out.println(s);}
    	
    
    }
    
    ---------- END SOURCE ----------
    


  •  I know that one, add the following to your JVM options:

    -Djava.net.preferIPv4Stack=true

    I think i read once that this is caused by the windows firewall having issues with ipv6, anyway it was some windows-specific issue.

     

     





  • @Ben L. said:

    I'm sure obscure necromancy art is only effective against those who've been posting here a while...



  • @PJH said:

    @Ben L. said:
    I'm sure obscure necromancy art is only effective against those who've been posting here a while...
    Isn't the point of an inside joke that some people don't get it?



  • Necromancy aside, the problem solved itself with java 7u07. Don't ask me how...



  • @ekolis said:

    Does anyone actually use Java 7? It was released a year or two ago as I recall, but still everything requires only Java 6 (or even 5) - even the "do you have Java installed?" site points to Java 6!
     

    Hi, I am a beginner and want to start learning Java programming. I have not enough knowledge about Java programming and about its all version. Can you provide me some information about java and its all version. Which one is good to start learning?

     


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.