Service Virtualization

 View Only
Expand all | Collapse all

Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

  • 1.  Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted 23 days ago

    Hi Team , 

    Our project is using Mulesoft Endpoint for the REST API calls. I am using SSL certificate, for which I have mentioned the details in the local.properties file in my workstation.

    ssl.client.cert.path=C:\\Users\\12345\\DevTest\\Projects\\samplecert.com.pfx
    ssl.client.cert.pass=password
    https.protocols=TLSv1.2,TLSv1.1,TLSv1

    lisa.net.trustStore=C:\\Users\\12345\\DevTest\\Projects\\samplecert.com.jks
    lisa.net.trustStore.password=password

    Note : Same password is used for the .pfx and .jks file. 

    When I try to run the sample test case in ITR mode, I get the below error . Please let me know what can be done to fix this.

    ============================================================================
    | HTTP
    ============================================================================
    | Step:        AddCustomer
    ----------------------------------------------------------------------------
    | Message:     java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    | Trapped Exception: Connection reset by peer: socket write error
    | Trapped Message:   java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    STACK TRACE
    java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
        at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
        at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
        at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:879)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:850)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:720)
        at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1144)
        at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1333)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1243)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:373)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:535)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:403)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
        at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
        at com.itko.lisa.test.CommTrans.doSend(CommTrans.java:1082)
        at com.itko.lisa.test.CommTrans.send(CommTrans.java:851)
        at com.itko.lisa.test.CommTrans.sendPOST(CommTrans.java:811)
        at com.itko.lisa.ws.rest.RESTNode.doSend(RESTNode.java:226)
        at com.itko.lisa.ws.rest.RESTNode.doWebTrans(RESTNode.java:171)
        at com.itko.lisa.ws.rest.RESTNodeBase.execute(RESTNodeBase.java:380)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
        at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
        at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
        at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1120)
        at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:73)
        at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:1022)
        at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:195)
        at java.lang.Thread.run(Thread.java:748)
    ============================================================================



    ------------------------------
    Shalini Murukes
    ------------------------------


  • 2.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Broadcom Employee
    Posted 23 days ago
    Hi Shalini
    Can you do the following to diagnose this further.


    - Edit the file workstation.vmoptions in LISA_HOME/bin folder
    - Add the following line and save the file
    - -Djavax.net.debug=ssl
    - Restart Workstation and repeat the test
    - Share the workstation.log file from USER_HOME/lisatmp_x.x.x folder for
    analysis


    --
    regards
    Sankar Natarajan

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 3.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted 23 days ago

    Hi Sankar, 

    I have followed the steps you mentioned and have posted the log file for your analysis as a private message to your inbox. 




  • 4.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Broadcom Employee
    Posted 23 days ago
    HI Shalini
    The log file has been reviewed. Please follow the procedure below
    and let me know if it solves the reported issue:

    1. On the Workstation Machine, open the file LISA_HOME/local.properties in
    a text editor
    2. Add the following property

    lisa.server.https.cipher.suites=TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_GCM_SHA256

    3. Save the file and restart workstation
    4. Repeat the test and let me know the outcome
    5. If the problem persists. then please share the workstation log file for
    further analysis

    regards
    Sankar Natarajan

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 5.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted 23 days ago

    Hi Sankar,

    Thank you, will give it a try and let you know the outocme.




  • 6.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted 23 days ago

    Hi Sankar,

    After making the above said changes in the {LISA_Home} local properties file, I get below error for POST call

    NOTE : I have sent detailed log to your inbox.

    ============================================================================
    | HTTP
    ============================================================================
    | Step:        AddRetailParticipant
    ----------------------------------------------------------------------------
    | Message:     java.net.SocketException: Connection reset
    ----------------------------------------------------------------------------
    | Trapped Exception: Connection reset
    | Trapped Message:   java.net.SocketException: Connection reset
    ----------------------------------------------------------------------------
    STACK TRACE
    java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:210)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
        at sun.security.ssl.InputRecord.read(InputRecord.java:503)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
        at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1761)
        at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:124)
        at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1152)
        at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1333)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1243)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:373)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.j

    And for Get Calls, I get the below error, 

    ============================================================================
    | HTTP
    ============================================================================
    | Step:        GetParticipant
    ----------------------------------------------------------------------------
    | Message:     java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    | Trapped Exception: Connection reset by peer: socket write error
    | Trapped Message:   java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    STACK TRACE
    java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
        at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
        at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
        at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:879)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:850)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:720)
        at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1144)
        at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1333)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1243)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:373)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)




  • 7.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted 23 days ago
    Edited by Shalini Murukes 23 days ago

    Hi Sankar, 

    The issue is resolved. The certificate had  .p12 as extension, instead of .pfx. After changing that, it worked correctly. 

    Thank You so much for your effort in finding a solution for the issue.




  • 8.  RE: Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error