Forum Stats

  • 3,768,499 Users
  • 2,252,800 Discussions
  • 7,874,600 Comments

Discussions

URLConnections,

User13468339-Oracle
User13468339-Oracle Member Posts: 90 Employee
edited Dec 9, 2016 10:38AM in Java User Groups Discussions

Hello Expert, I am facing a strange issue which the below code when executed on windows it works fine but the same code when trying to run on linux it gives 504 bad gateway error. Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("X.X.X.X", 8080)); //Change the proxy address accordingly and try URL url =  new URL(null,"http://XXX/login.jsp",new sun.net.www.protocol.http.Handler()); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); Integer responseCode = connection.getResponseCode(); When i print the response code i get 504 on linux and on windows I get 200.         JDK version 1.6.35 oracle sun jdk and it is same for both windows and linux.         Any suggestion or inputs will help me to fix this issue. Also note that there is no firewal or proxy setting.. Thanks Chetan

eudriscabrera-JavaNet

Answers

  • karianna
    karianna Member Posts: 205 Blue Ribbon
    edited Dec 9, 2016 10:38AM

    Hi there,

    This question should be moved to the appropriate Java --> Networking space.  Can a moderator please move?

    As an aside, I would not be using Java 1.6.0_35 it has many security vulnerabilities and is no longer supported.

    eudriscabrera-JavaNet