SOAP SSL handshake fails on JBoss

Hi All

I have code that runs as a stand-alone application. It makes a SOAP call to a server over HTTPS. My problem is that the same code fails on JBoss and I can't figure out why. My code below

System.setProperty("javax.net.ssl.keyStore", keystoreFilePath);

System.setProperty("javax.net.ssl.keyStorePassword", "AbLayer");

System.setProperty("javax.net.ssl.keyStoreType", "JKS");

System.setProperty("javax.net.ssl.trustStore", truststoreFilePath);

System.setProperty("javax.net.ssl.trustStorePassword", "AbLayer");

System.setProperty("javax.net.ssl.trustStoreType", "JKS");

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() );

SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection();

requestMessage.writeTo(java.lang.System.out);

SOAPMessage responseMessage = soapConnection.call(requestMessage, url);

When I run this on JBoss I get:

B09:16:13,761 INFO [STDOUT] http-0.0.0.0-8080-3, handling exception: java.net.SocketException: Connection reset

09:16:14,277 INFO [STDOUT] http-0.0.0.0-8080-3

09:16:14,277 INFO [STDOUT] , SEND TLSv1 ALERT:

09:16:14,277 INFO [STDOUT] fatal,

09:16:14,277 INFO [STDOUT] description = unexpected_message

09:16:14,277 INFO [STDOUT] http-0.0.0.0-8080-3, WRITE: TLSv1 Alert, length = 2

09:16:14,277 INFO [STDOUT] http-0.0.0.0-8080-3, Exception sending alert: java.net.SocketException: Connection reset by peer: socket write error

09:16:14,277 INFO [STDOUT] http-0.0.0.0-8080-3, called closeSocket()

09:16:14,277 ERROR [STDERR] 2007/05/23 09:16:14 com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post

SEVERE: SAAJ0009: Message send failed

Does anyone have any ideas?

I am using JBoss 4.0.5GA JDK 1.6

Regards

Alfred

[1967 byte] By [alfred.rsaa] at [2007-11-27 5:12:45]
# 1

> System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

> Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() );

If you're using 1.6, or anything from 1.4 onwards, you should delete both those lines.

What does the JBoss log have to say about it?

ejpa at 2007-7-12 10:33:55 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2

After removing the two lines I get:

11:46:34,558 INFO [STDOUT] keyStore is : D:\Development\Code\BE100KJBoss\doc\al_keystore_cl.jks

11:46:34,793 INFO [STDOUT] keyStore type is : JKS

11:46:34,793 INFO [STDOUT] keyStore provider is :

11:46:34,793 INFO [STDOUT] init keystore

11:46:34,793 INFO [STDOUT] init keymanager of type SunX509

11:46:34,808 INFO [STDOUT] ***

11:46:34,808 INFO [STDOUT] found key for : bo_selby_cl

11:46:34,808 INFO [STDOUT] chain [0] = [

[

Version: V1

Subject: CN=Banking_Ops_Selby_Pres, OU=Retail, O=Banking Ops, L=Selby, ST=Gauteng, C=za

Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4

Key: Sun RSA public key, 1024 bits

modulus: 137440095935618430555592539462212383058696081826069846835364811888236633440087620093961137684430725690580749978186349917436678388068581410238534591866902072281783505284729085226821162894360071376538852493592678541013440603483848242144956729035598514558086142326468602610468673096185686574024982467419548679729

public exponent: 65537

Validity: [From: Sat May 19 08:43:08 CAT 2007,

To: Sun May 18 08:43:08 CAT 2008]

Issuer: CN=Banking_Ops_Selby_Pres, OU=Retail, O=Banking Ops, L=Selby, ST=Gauteng, C=za

SerialNumber: [464e9c7c]

]

Algorithm: [MD5withRSA]

Signature:

0000: 5A 6D D9 8C E0 2A D6 6092 A7 33 4D B9 D9 A1 57 Zm...*.`..3M...W

0010: BC C3 06 0D DA 1B E1 A785 04 E1 B0 5E D9 B9 68 ............^..h

0020: F2 49 BC 70 DE 58 28 BD23 ED F6 FF 76 FB 28 03 .I.p.X(.#...v.(.

0030: E9 E7 E6 BB DB CE 9C 9780 71 F4 7B 13 84 6D 6E .........q....mn

0040: 48 EF E0 10 0F CE 27 733C 8B 43 90 E7 9C 9F 62 H.....'s<.C....b

0050: BC 43 D4 7D 1A 1E 45 201F FC 7D E8 97 D7 38 74 .C....E ......8t

0060: D9 5D 09 D0 63 32 CD 3482 26 93 1F C8 43 45 34 .]..c2.4.&...CE4

0070: E8 63 A4 28 A5 8A 73 E48E CF EC 1B 2A 7C 32 EB .c.(..s.....*.2.

]

11:46:35,293 INFO [STDOUT] ***

11:46:35,293 INFO [STDOUT] trustStore is: D:\Development\Code\BE100KJBoss\doc\al_truststore_cl.jks

11:46:35,293 INFO [STDOUT] trustStore type is : JKS

11:46:35,293 INFO [STDOUT] trustStore provider is :

11:46:35,293 INFO [STDOUT] init truststore

11:46:35,293 INFO [STDOUT] adding as trusted cert:

11:46:35,293 INFO [STDOUT]Subject: CN=egami-test, OU=Retail, O=Banking Ops, L=South Africa, ST=Gauteng, C=za

11:46:35,293 INFO [STDOUT]Issuer: CN=egami-test, OU=Retail, O=Banking Ops, L=South Africa, ST=Gauteng, C=za

11:46:35,293 INFO [STDOUT]Algorithm: RSA; Serial number: 0x464e9c79

11:46:35,293 INFO [STDOUT]Valid from Sat May 19 08:43:05 CAT 2007 until Sun May 18 08:43:05 CAT 2008

11:46:35,293 INFO [STDOUT] trigger seeding of SecureRandom

11:46:35,793 INFO [STDOUT] done seeding SecureRandom

11:46:36,215 INFO [STDOUT] %% No cached client session

11:46:36,230 INFO [STDOUT] *** ClientHello, TLSv1

11:46:36,230 INFO [STDOUT] RandomCookie:

11:46:36,230 INFO [STDOUT] %% No cached client session

11:46:36,230 INFO [STDOUT] *** ClientHello, TLSv1

11:46:36,230 INFO [STDOUT] GMT: 1179913596

11:46:36,230 INFO [STDOUT] bytes = {

11:46:36,230 INFO [STDOUT] 87

11:46:36,230 INFO [STDOUT] ,

11:46:36,230 INFO [STDOUT] 234

11:46:36,230 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 57

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 36

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 111

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 76

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] RandomCookie:

11:46:36,308 INFO [STDOUT] 79

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 166

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 178

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 101

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 45

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 125

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 201

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 38

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 78

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 40

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 171

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 176

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 79

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 95

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 164

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 250

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 240

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 162

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 50

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 227

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 226

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 126

11:46:36,308 INFO [STDOUT] }

11:46:36,308 INFO [STDOUT] Session ID:

11:46:36,308 INFO [STDOUT] {}

11:46:36,308 INFO [STDOUT] Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]

11:46:36,308 INFO [STDOUT] GMT: 1179913596

11:46:36,308 INFO [STDOUT] bytes = {

11:46:36,308 INFO [STDOUT] 69

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 70

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 206

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 249

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 38

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 46

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 18

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 90

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 72

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 239

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 167

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 93

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 207

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 68

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 38

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 198

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 93

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 167

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 48

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 238

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 113

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 232

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 51

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 227

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 116

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 122

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 149

11:46:36,308 INFO [STDOUT] ,

11:46:36,308 INFO [STDOUT] 195

11:46:36,308 INFO [STDOUT] }

11:46:36,308 INFO [STDOUT] Session ID:

11:46:36,308 INFO [STDOUT] {}

11:46:36,308 INFO [STDOUT] Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]

11:46:36,308 INFO [STDOUT] Compression Methods: {

11:46:36,308 INFO [STDOUT] 0

11:46:36,308 INFO [STDOUT] }

11:46:36,308 INFO [STDOUT] ***

11:46:36,308 INFO [STDOUT] [write] MD5 and SHA1 hashes: len = 73

And eventually:

1:47:01,386 INFO [STDOUT] http-0.0.0.0-8080-3, handling exception: java.net.SocketException: Connection reset

11:47:01,386 ERROR [STDERR] 2007/05/23 11:47:01 com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post

SEVERE: SAAJ0009: Message send failed

11:47:01,386 INFO [STDOUT] http-0.0.0.0-8080-3

11:47:01,386 INFO [STDOUT] , SEND TLSv1 ALERT:

11:47:01,386 INFO [STDOUT] fatal,

11:47:01,386 ERROR [STDERR] com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed

11:47:01,386 INFO [STDOUT] description = unexpected_message

11:47:01,886 INFO [STDOUT] http-0.0.0.0-8080-3, WRITE: TLSv1 Alert, length = 2

11:47:01,386 ERROR [STDERR] at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)

11:47:01,886 ERROR [STDERR] at za.co.fnb.egamidocverify.EGamiDocumentExtract.extractImage(EGamiDocumentExtract.java:85)

11:47:01,886 ERROR [STDERR] at za.co.fnb.be100konline.actions.LogonAction.execute(LogonAction.java:75)

11:47:01,886 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)

11:47:02,386 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)

11:47:02,386 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)

11:47:02,386 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

11:47:02,386 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

11:47:02,386 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

11:47:02,386 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

11:47:02,886 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

11:47:02,886 ERROR [STDERR] at za.co.fnb.be100konline.web.filters.BE100KRequestFilter.doFilter(BE100KRequestFilter.java:57)

11:47:02,886 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

11:47:02,886 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

11:47:02,886 ERROR [STDERR] at za.co.fnb.be100konline.web.filters.BE100KRequestFilter.doFilter(BE100KRequestFilter.java:57)

11:47:01,886 INFO [STDOUT] http-0.0.0.0-8080-3, Exception sending alert: java.net.SocketException: Connection reset by peer: socket write error

Regards

Alfred

alfred.rsaa at 2007-7-12 10:33:55 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...