dcsimg
URGENT!!!! getting java.net.ConnectException
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_v
Posted On:   Sunday, December 28, 2003 08:53 PM

Hi All, I am trying to connect to a website for getting data. I am using weblogic 8.1 and my internet connection is thru proxy server. but it is getting the following exception. java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'www.oanda.com', port: '80' at weblogic.net.http.HttpClient.openServer(HttpClient.java:240) at weblogic.net.http.HttpClient.openServer(HttpClient.java:292) at weblogic.net.http.HttpClient. (HttpClient.java:128) at weblogic.net.http.HttpClient.New(HttpClient.java:170) at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:112) If i am running the same outside weblogic environment, i'm abl   More>>

Hi All,



I am trying to connect to a website for getting data. I am using weblogic 8.1 and my internet connection is thru proxy server.



but it is getting the following exception.



java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'www.oanda.com', port: '80' at weblogic.net.http.HttpClient.openServer(HttpClient.java:240) at weblogic.net.http.HttpClient.openServer(HttpClient.java:292) at weblogic.net.http.HttpClient. (HttpClient.java:128) at weblogic.net.http.HttpClient.New(HttpClient.java:170) at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:112)



If i am running the same outside weblogic environment, i'm able to connect to the site.



My code is as below



private String getHTMLFor() {


String textString ="";


String s = "";


BufferedReader br;


try


{


String proxy_internet_address = "190.112.11.11";


int proxy_internet_port = 80;


ProxyAuthenticator proxAuth = new ProxyAuthenticator("userid","pwd");


java.net.Authenticator.setDefault(proxAuth);




URL url = new URL("http://www.oanda.com/convert/classic?value=1&exch=GBP&expr=IQD&date=12/23/03");




java.util.Properties systemProperties = System.getProperties();


systemProperties.setProperty("http.proxyHost",proxy_internet_address);


systemProperties.setProperty("http.proxyPort",String.valueOf(proxy_internet_port));




HttpURLConnection aConnection = (HttpURLConnection)(url.openConnection());


aConnection.setDoInput(true);


aConnection.setDoOutput(true);


aConnection.setUseCaches(false);


aConnection.connect();



InputStreamReader insr = new InputStreamReader(aConnection.getInputStream());


br = new BufferedReader(insr);


while((textString = br.readLine())!=null){


s = s + textString;


}


br.close();


aConnection.disconnect();


} catch(Exception ex) {


ex.printStackTrace();


}


return s;


}



Pls help me insolving this problem.



Regards,


Srinivas

   <<Less

Re: URGENT!!!! getting java.net.ConnectException

Posted By:   Stephan_Przibylla  
Posted On:   Friday, January 30, 2004 02:00 AM

hi srinvas,
did you find a solution in the meantime?
i have exactly the same problem and all i have found out is that bea uses its own proxy authenticator interface
but i have no idea how to manage this.
so if you know something more please let me know.

thanks in advance,
Stephan

Re: URGENT!!!! getting java.net.ConnectException

Posted By:   Ajit_Malleri  
Posted On:   Tuesday, January 6, 2004 10:17 PM

After you set the properties, set those in the System properties. ie. System.setProperties(systemProperties). Let me know if that helps.
About | Sitemap | Contact