You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Peter Gylling Jørgensen <Pe...@frv.dk> on 2007/04/11 15:07:49 UTC

CustomSSLSocketFactory combined with Axis2 - works once, but not several times?

Dear all,

I would like a little help on this issue.

I have a AXIS2 v. 1.1.1 client code which talks to a HTTPS based OpenSSL SOAP service. 

So far so good. I can do the following:

1. Connect with a standalone HttpClient using a custom SSLSocketFactory and a custom Protocol

So I know I have a solution for solving how the client and server communicates together, but I cannot make the AXIS2 client talk fluently to the server.

In my unit test code, I have say 5 different connections to request different methods to be excecuted on the server, an usually the first and the second will work, then the third will fail, no matter the sequence

Below you will find the usual error, which I need help to find a solution for.

[DEBUG] 11 Apr 2007 13:03:51,132 se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
	Will delete private job: 1179
[INFO ] 11 Apr 2007 13:03:51,163 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	I/O exception (org.apache.axis2.AxisFault) caught when processing request: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake
[INFO ] 11 Apr 2007 13:03:51,163 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	Retrying request
[INFO ] 11 Apr 2007 13:03:51,210 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	I/O exception (org.apache.axis2.AxisFault) caught when processing request: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake
[INFO ] 11 Apr 2007 13:03:51,210 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	Retrying request
[INFO ] 11 Apr 2007 13:03:51,257 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	I/O exception (org.apache.axis2.AxisFault) caught when processing request: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake
[INFO ] 11 Apr 2007 13:03:51,257 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
	Retrying request
[ERROR] 11 Apr 2007 13:03:51,288 se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
	RemoteException: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake
[DEBUG] 11 Apr 2007 13:03:51,288 se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
	StackTrace: 
org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake; nested exception is: 
	org.apache.axis2.AxisFault: Remote host closed connection during handshake; nested exception is: 
	com.ctc.wstx.exc.WstxIOException: Remote host closed connection during handshake
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
	at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
	at se.smhi.seatrack.ais.DbserverStub.DeleteJob(DbserverStub.java:446)
	at se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob(DbserverStubTest.java:469)

..... <cut> .....

Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
	at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA12275)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
	at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:190)
	at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
	at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:184)
	at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
	... 38 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275)
	... 48 more

\pgj
--
Peter Gylling Jørgensen
Modelling group, section of Oceanography
Royal Danish Administration of Navigation and Hydrography 
Overgaden o. Vandet 62B DK-1023 København K 
Phone: +45 32 68 96 85
Email: peg@frv.dk
www: http://www.frv.dk/ 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: CustomSSLSocketFactory combined with Axis2 - works once, but not several times?

Posted by Peter Gylling Jørgensen <Pe...@frv.dk>.
Dear Mahesh,
 
thanks for your answer, I think I must have the company running the server to look into the server log when I try to connect. I think it's rather strange too.
 
I will return after that session.
 
\pgj

	-----Original Message-----
	From: Mahesh Rachakonda [mailto:rachakonda@gmail.com] 
	Sent: Thursday, April 12, 2007 5:39 PM
	To: axis-user@ws.apache.org
	Subject: Re: CustomSSLSocketFactory combined with Axis2 - works once, but not several times?
	
	
	I tried to follow your code, and I am not sure why it is failing. I am using a custom SSLSocketFactory, wrap it as a SecureProtocolSocketFactory and registering a new Protocol much like you are doing. I am able to execute thousands of calls without any problems. 
	
	Mahesh
	
	


Re: CustomSSLSocketFactory combined with Axis2 - works once, but not several times?

Posted by Mahesh Rachakonda <ra...@gmail.com>.
I tried to follow your code, and I am not sure why it is failing. I am using
a custom SSLSocketFactory, wrap it as a SecureProtocolSocketFactory and
registering a new Protocol much like you are doing. I am able to execute
thousands of calls without any problems.

Mahesh

SV: CustomSSLSocketFactory combined with Axis2 - works once, but not several times?

Posted by Peter Gylling Jørgensen <Pe...@frv.dk>.
Dear all,

I have found exactly what breaks my test case, but I don't understand why. The code sample shows what happens and you can find a typical log in my previous mail. Apparently I can successfully connect once and retrieve an answer once, but second request will fail with SSL Handshake error.

Please point me in the direction to go to fix this "feature".

Can there be an issue of AXIS libraries not only using the HttpClient for connections?

\pgj

//---------------------------
// Code, that fails
//---------------------------
// Get joblist
JobInfo[] jobList = (JobInfo[])DbserverStubTest.jobListResponse.getResponse();

// Setup trust
this.activateTrust();
if(DbserverStubTest.sslFactory == null) {
	DbserverStubTest.fatalError = true;
	Assert.fail();
	return;
}
// Define new protocol
Protocol trustHttps = new Protocol("https", DbserverStubTest.sslFactory, 6001);
Protocol.registerProtocol("https", trustHttps);

// Loop joblist and delete jobs
for(int i=0; i<jobList.length; ++i) {
	// Don't deleted shared jobs (public)
	if(!jobList[i].localFIsPublic) {
		UnsignedInt jobId = jobList[i].getUiJobId();
		DeleteJob deleteJob = new DeleteJob();
		deleteJob.setSzUser(DbserverStubTest.user.userName);
		deleteJob.setUiJobId(jobId);
		try {
			log.debug("Will delete private job: "+jobId);
			DeleteJobStatus deleteStatus = DbserverStubTest.dbserverStub.DeleteJob(deleteJob);
			if(!deleteStatus.localFDeleteOK) {
				log.debug("DeleteStatus: "+deleteStatus.localSzErrorMsg);
			}
			Thread.sleep(1000l);
		} catch (RemoteException e) {
			log.error("RemoteException: "+e.getMessage());
			log.debug("StackTrace: ",e);
			DbserverStubTest.fatalError = true;
			Assert.fail();
		} catch (InterruptedException e) {
			log.error("InterruptedException: "+e.getMessage());
			log.debug("StackTrace: ",e);
			DbserverStubTest.fatalError = true;
			Assert.fail();
		}
		// If I uncomment the break statement, the test will succeed.
		// In other words the second request will always fail!
		//break;  <-- 
	}
} 




> -----Oprindelig meddelelse-----
> Fra: Peter Gylling Jørgensen [mailto:Peg@frv.dk] 
> Sendt: 11. april 2007 15:08
> Til: axis-user@ws.apache.org
> Emne: CustomSSLSocketFactory combined with Axis2 - works 
> once, but not several times?
> 
> Dear all,
> 
> I would like a little help on this issue.
> 
> I have a AXIS2 v. 1.1.1 client code which talks to a HTTPS 
> based OpenSSL SOAP service. 
> 
> So far so good. I can do the following:
> 
> 1. Connect with a standalone HttpClient using a custom 
> SSLSocketFactory and a custom Protocol
> 
> So I know I have a solution for solving how the client and 
> server communicates together, but I cannot make the AXIS2 
> client talk fluently to the server.
> 
> In my unit test code, I have say 5 different connections to 
> request different methods to be excecuted on the server, an 
> usually the first and the second will work, then the third 
> will fail, no matter the sequence
> 
> Below you will find the usual error, which I need help to 
> find a solution for.
> 
> [DEBUG] 11 Apr 2007 13:03:51,132 
> se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
> 	Will delete private job: 1179
> [INFO ] 11 Apr 2007 13:03:51,163 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	I/O exception (org.apache.axis2.AxisFault) caught when 
> processing request: Remote host closed connection during 
> handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake
> [INFO ] 11 Apr 2007 13:03:51,163 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	Retrying request
> [INFO ] 11 Apr 2007 13:03:51,210 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	I/O exception (org.apache.axis2.AxisFault) caught when 
> processing request: Remote host closed connection during 
> handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake
> [INFO ] 11 Apr 2007 13:03:51,210 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	Retrying request
> [INFO ] 11 Apr 2007 13:03:51,257 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	I/O exception (org.apache.axis2.AxisFault) caught when 
> processing request: Remote host closed connection during 
> handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake
> [INFO ] 11 Apr 2007 13:03:51,257 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> 	Retrying request
> [ERROR] 11 Apr 2007 13:03:51,288 
> se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
> 	RemoteException: Remote host closed connection during 
> handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake
> [DEBUG] 11 Apr 2007 13:03:51,288 
> se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob
> 	StackTrace: 
> org.apache.axis2.AxisFault: Remote host closed connection 
> during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake; nested exception is: 
> 	org.apache.axis2.AxisFault: Remote host closed 
> connection during handshake; nested exception is: 
> 	com.ctc.wstx.exc.WstxIOException: Remote host closed 
> connection during handshake
> 	at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.inv
> oke(CommonsHTTPTransportSender.java:227)
> 	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
> 	at 
> org.apache.axis2.description.OutInAxisOperationClient.send(Out
> InAxisOperation.java:237)
> 	at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(
> OutInAxisOperation.java:202)
> 	at 
> se.smhi.seatrack.ais.DbserverStub.DeleteJob(DbserverStub.java:446)
> 	at 
> se.smhi.seatrack.ais.DbserverStubTest.testDeleteJob(DbserverSt
> ubTest.java:469)
> 
> ..... <cut> .....
> 
> Caused by: javax.net.ssl.SSLHandshakeException: Remote host 
> closed connection during handshake
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
> 	at 
> com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA12275)
> 	at 
> java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
> 	at 
> java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
> 	at 
> org.apache.commons.httpclient.ChunkedOutputStream.flush(Chunke
> dOutputStream.java:190)
> 	at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
> 	at 
> com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:184)
> 	at 
> com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
> 	... 38 more
> Caused by: java.io.EOFException: SSL peer shut down incorrectly
> 	at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275)
> 	... 48 more
> 
> \pgj
> --
> Peter Gylling Jørgensen
> Modelling group, section of Oceanography
> Royal Danish Administration of Navigation and Hydrography 
> Overgaden o. Vandet 62B DK-1023 København K 
> Phone: +45 32 68 96 85
> Email: peg@frv.dk
> www: http://www.frv.dk/ 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org