Skip to Main Content

Java User Groups

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

at java.net.SocketInputStream.read(SocketInputStream.java:168)

2698849Feb 9 2020 — edited Feb 9 2020

Provide any suggestions to resolve this issue.

NOTE: Environment is fixed. No upgrades will happen at this time. Just resolve the issue.

Application Server: WebSphere 7

Java version: 1.6.0.161

OS: Solaris

Experiencing "Connection Reset" error message while open the HTTPS connection in java code

Code Snippet:

String json = mattArray.toString().trim();

URL url = new URL(https_url);

HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();

conn.setConnectTimeout(5000);

    conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");

    conn.setDoOutput(true);

    conn.setDoInput(true);

    conn.setRequestMethod("POST");

    OutputStream os = conn.getOutputStream();   --> Error triggering at this line

    os.write(json.getBytes("UTF-8"));

    os.close();

Error Message

2020-02-07 10:51:14,190 [system] [DEBUG] [rule] SendMatter.log - ERROR2 :java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(SocketInputStream.java:168)

        at com.ibm.jsse2.a.a(a.java:148)

        at com.ibm.jsse2.a.a(a.java:96)

        at com.ibm.jsse2.tc.a(tc.java:302)

        at com.ibm.jsse2.tc.g(tc.java:208)

        at com.ibm.jsse2.tc.a(tc.java:482)

        at com.ibm.jsse2.tc.startHandshake(tc.java:597)

        at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:44)

        at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:36)

        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)

        at com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(b.java:66)

        at A087049_SendMattertoLegalHoldProLA.doAction(A087049_SendMattertoLegalHoldProLA.java:583)

        at A087049_SendMattertoLegalHoldProLA$1.call(A087049_SendMattertoLegalHoldProLA.java:85)

        at com.mitratech.teamconnect.base.factory.FQUtility.runAsSystemUser(FQUtility.java:703)

        at com.mitratech.teamconnect.entity.factory.FNUtility.runAsSystemUser(FNUtility.java:488)

        at A087049_SendMattertoLegalHoldProLA.action(A087049_SendMattertoLegalHoldProLA.java:83)

        at com.mitratech.teamconnect.base.factory.FQAppvEngine.executeAutomatedAction(FQAppvEngine.java:5832)

        at com.mitratech.teamconnect.base.factory.TCAutomatedActionJob$1.call(TCAutomatedActionJob.java:106)

        at com.mitratech.teamconnect.base.factory.FQUtility.runAsSystemUser(FQUtility.java:703)

        at com.mitratech.teamconnect.base.factory.FQUtility.runAsSystemUserInDomain(FQUtility.java:671)

        at com.mitratech.teamconnect.base.factory.TCAutomatedActionJob.execute(TCAutomatedActionJob.java:48)

        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)

        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

Comments

Nigel Deakin-Oracle
Are the two GlassFish instances configured to be part of the same GlassFish cluster? If so then you don't need to do anything. MyQueue will work as a single queue for both instances.

If the two GlassFish instances are NOT clustered then you have two separate queues, both with the JNDI name MyQueue. In this case you need to either

1. Configure the sending application to send messages to the other instance
2. Configure the MDB to receive messages from the other instance

(obviously you must do one or the other, not both!).

To define which instance a MDB receives messages from, set the activation config property connectionURL to point to the other instance. This will have the form mq://hostname:jmsport

To define which instance an application sends messages to, set the connection factory property addressList to point to the other instance. Again, this will have the form mq://hostname:jmsport

Don't forget that when you create the Queue object with JNDI name jms/MyQueue you need to define a property "Name" and set it to the actual name of the queue.

Nigel
883902
Hi,

The first thing I would like to suggest is, we never/can't send message directly to MDB. We always send/receive message(s) to/from the destination. In case of MDB, the application server register the MDB as message listener against particular destination, and invoked the onMessage() method when message arrives on particular destination.

If I am not wrong, what you want to achieve is asynchronous communication between two applications deployed in two different machine. In your case, you want your one application works as message producer and other act as an message consumer, and both are deployed in different machine.

In this situations, you only need to configure the JMS administration object, connection factories and destinations, on one Application server and configure other application server to use those configuration using JMS resource adapter. you can well achieve this by configuring the JMS Resource Adapter. you need to check the Glassfish documentation.

If you don't want to break the JMS specification, always communicate with Messaging Provider through Resource Adapter.

I hope this helps.
1 - 2

Post Details

Added on Feb 9 2020
1 comment
1,148 views