[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1149
  • Last Modified:

java SocketTimeoutException running under WAS

Hi,

I'm getting the following error whilst trying to create a secured socket connection whilst running my application in Websphere App Server. (I don't get this error if I run on Tomcat!)

java.net.SocketTimeoutException: connect timed out
      at java.lang.Throwable.<init>(Throwable.java:195)
      at java.lang.Exception.<init>(Exception.java:41)
      at java.io.IOException.<init>(IOException.java:40)
      at java.net.SocketTimeoutException.<init>(SocketTimeoutException.java:24)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:488)
      at com.ibm.jsse2.by.connect(by.java:82)
      at com.ibm.jsse2.by.<init>(by.java:22)
      at com.ibm.jsse2.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:8)
      at com.ibm.net.ssl.www.protocol.https.b.b(Unknown Source)
      at com.ibm.net.ssl.www.protocol.http.ca.a(Unknown Source)
      at com.ibm.net.ssl.www.protocol.http.ca.p(Unknown Source)
      at com.ibm.net.ssl.www.protocol.https.b.<init>(Unknown Source)
      at com.ibm.net.ssl.www.protocol.https.b.a(Unknown Source)
      at com.ibm.net.ssl.www.protocol.https.q.c(Unknown Source)
      at com.ibm.net.ssl.www.protocol.https.q.connect(Unknown Source)
      at com.ibm.net.ssl.www.protocol.http.ch.getOutputStream(Unknown Source)
      at com.ibm.net.ssl.www.protocol.https.t.getOutputStream(Unknown Source)

Does anyone have any thoughts as to why I might be having this problem on WAS?

Cheers.
Steve

HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "application/xml;charset=utf-8");
try {
      	conn.connect();
} catch (Exception e) {
       	e.printStackTrace();
}

Open in new window

0
stevebeech
Asked:
stevebeech
  • 2
  • 2
1 Solution
 
BigRatCommented:
What is the URL? Is the port chosen correctly?
0
 
stevebeechAuthor Commented:
I think so:

The command: System.out.println("HttpsURLConnection: "+conn.toString());
              
gives:

HttpsURLConnection: com.ibm.net.ssl.www.protocol.https.r:https://myserver.net:9443/myapp

And it works just fine if I run the app under Tomcat4.1

Cheers, Steve
0
 
BigRatCommented:
So it's a setup problem in WebSphere. This could either be a firewall/proxy due to the new environment, port 9443 being blocked on the WebSphere machine (try doing a telnet from that machine), or the connection time out period is too small. There is a ConnectionIOTimeOut parameter somewhere, but it's a long time since I was on that platform :(
0
 
stevebeechAuthor Commented:
Thanks BigRat.

Connection appears to have been timing out.

Cheers.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now