For Programmers: Free Programming Magazines  


Home > Archive > Java Security > August 2005 > SSLHandShakeException









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SSLHandShakeException
vasanthkumarmurali@gmail.com

2005-08-26, 3:57 am

I am trying to connect securely to a web server using a URLConnection
object and I build this object using an https URL. I set all the
properties before I try to obtain the output stream on this connection.
When I do connection.getOutputStream() it throws the exception below.
The code is below.

I am using an applet that opens these connections. This exception
appears randomly when I use JRE 1.4.2_03. When I use JRE 1.3 I never
get this. This seems to happen after a while the applet has been up and
running and opening connections.

This has been causing a lot of problems and I would be grateful for any
pointers to solve this annoying problem.


URL url = new URL(path);
URLConnection connection = url.openConnection();
debug("connected to " + path);

connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setDefaultUseCaches(false);
connection.setAllowUserInteraction(true);

connection.setRequestProperty("CONTENT_TYPE","application/x-java-serialized-object");

Vector requestData = new Vector();
requestData.add(command);
requestData.add(hostName);

ObjectOutputStream writer = new
ObjectOutputStream(connection.getOutputStream());
writer.writeObject(requestData);
debug("wrote '" + command + "' to output stream");
writer.flush();
writer.close();

ObjectInputStream reader = new
ObjectInputStream(connection.getInputStream());

javax.net.ssl.SSLHandshakeException: Remote host closed connection
during handshake
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown
Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at
sun.net.www.protocol.https.AbstractDelegate...on.setNewClient(Unknown
Source)
at
sun.net.www.protocol.https.PluginDelegateHt...on.superConnect(Unknown
Source)
at
sun.net.www.protocol.https.PluginDelegateHt...nection.connect(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown
Source)
at
sun.net.www.protocol.https.HttpsURLConnecti...getOutputStream(Unknown
Source)
at
poslite.apm.core.APMManagerProxy. communicateWithAPMServlet(APMManagerProx
y.java:918)
at
poslite.apm.core.APMManagerProxy.processTransaction(APMManagerProxy.java:682)
at com.ncr.ExpressStation.doTransaction(ExpressStation.java:3837)
at com.ncr.ExpressStation.do_IPC(ExpressStation.java:3990)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
.... 21 more

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com