473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

SSL Connection: timed out

254 100+
Hi

My program needs to connect to https server and here is my java code:
Expand|Select|Wrap|Line Numbers
  1. URL server = null;
  2. HttpURLConnection conn = null;
  3. try{
  4.       System.setProperty("javax.net.ssl.keyStore", "eejis.jks");
  5.     System.setProperty("javax.net.ssl.keyStorePassword", "ee123");
  6.  
  7.      server = new URL("https", "123.123.1.1", 1234, path); 
  8.      System.err.println("conn1...");
  9.     conn = (HttpURLConnection)server.openConnection();
  10.     System.err.println("conn2...");
  11.     conn.setRequestMethod("POST");
  12.  
  13.     System.err.println("conn3...");
  14.     conn.connect();    
  15.     System.err.println("conn4...");    
  16. }
  17. catch (ProtocolException e)
  18. {
  19.     System.out.println("protocalException:");
  20.     e.printStackTrace();
  21. }
  22. catch (IOException e)
  23. {
  24.     System.out.println("ioException:");
  25.     e.printStackTrace();
  26. }
  27.  
our client server need us to install some certificate and create keystore for it and use it in the program.
I followed their steps and finally keystore is created eejis.jks.
I put eejis.jks under the same directory of the program sits.

The program give me the error below.
In the programm i remove system.setProperty() lines, and run program also hit same error.
It keeps telling me Connection : Timed Out

It can open a connection but cannot use connect function?

Can anyone tell me what's wrong?
I ran out of idea.
p.s: i still dont think the issue is from the keystore thing.


Expand|Select|Wrap|Line Numbers
  1. conn1...
  2. conn2...
  3. conn3...
  4. ioException:
  5. java.net.ConnectException: Connection timed out: connect
  6.         at java.net.PlainSocketImpl.socketConnect(Native Method)
  7.         at java.net.PlainSocketImpl.doConnect(Unknown Source)
  8.         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
  9.         at java.net.PlainSocketImpl.connect(Unknown Source)
  10.         at java.net.Socket.connect(Unknown Source)
  11.         at java.net.Socket.connect(Unknown Source)
  12.         at sun.net.NetworkClient.doConnect(Unknown Source)
  13.         at sun.net.www.http.HttpClient.openServer(Unknown Source)
  14.         at sun.net.www.http.HttpClient.openServer(Unknown Source)
  15.         at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
  16.         at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
  17.         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewH
  18. ttpClient(Unknown Source)
  19.         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
  20. ce)
  21.         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
  22. (Unknown Source)
  23.         at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Sou
  24. rce)
  25.         at asiamsms.maxis.RequestProductForMaxis.getHttpUrlConnection(RequestPro
  26. ductForMaxis.java:196)
  27.         at asiamsms.maxis.RequestProductForMaxis$RemindTask.run(RequestProductFo
  28. rMaxis.java:143)
  29.         at java.util.TimerThread.mainLoop(Unknown Source)
  30.         at java.util.TimerThread.run(Unknown Source)
  31.  
  32.  
Mar 26 '09 #1
0 2588

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mithun Verma | last post by:
Hello All, I am working on a windows application which will talk to the database through the Web services. So i need to enhaance the performance, for which i m using connection
7
by: mfeingold | last post by:
I am working on a system, which among other things includes a server and a ..net control sitting in an html page and connected to the server. I ran into a couple of problems, you guys might have...
0
by: Anthony Banks | last post by:
I get error below when trying to build my application. Could not copy built outputs to the Web. Unable to add 'C:\Documents and Settings\Anthony...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
7
by: MLH | last post by:
I have been using variations of the following to determine whether a functional connection to internet exists. I'm thinking of replacing it with a simple PING, but I've never seen any code for...
6
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after...
0
by: Christian V | last post by:
We have a Web service hosted in IIS 6 under Windows Server 2003. The Web service handles quite a bit of requests these days and sometimes gives out the dreaded "operation has timed-out" exception....
0
by: nickyeng | last post by:
what is the possibility that java.net.ConnectionException will be thrown ? i have a form in jsp, once finish fill up i enter submit button, it will go thank you page. In Thank you page, i save the...
3
rhitam30111985
by: rhitam30111985 | last post by:
hi all,,, i am testing a web crawler on a site passsed as a command line argument.. it works fine until it finds a server which is down or some other error ... here is my code: #!...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.