Discussion:
On JMS MQ connector - CTGDIS810E handleException - cannot handle exception , get java.lang.InterruptedException
(too old to reply)
mue...@bc.edu
2021-05-07 02:50:25 UTC
Permalink
This is a strange error. I am using MQ with the JMS connector and have set it up properly in our DEV environment. It can run fine via the remote api command or thru the GUI

When I deployed it today, and tried to start it up using the remote api command, I received this error message on the

2021-05-06 19:20:54,091 INFO [org.apache.log4j.DailyRollingFileAppender.0770ee72-2206-4414-ade9-66eb4a24c184] - [modifyDSEEPeepsAttributes] CTGDIS046I Initialization finished.
2021-05-06 19:20:54,091 DEBUG [org.apache.log4j.DailyRollingFileAppender.0770ee72-2206-4414-ade9-66eb4a24c184] - CTGDIS074I Finished initializing Connectors.
2021-05-06 19:20:54,091 INFO [org.apache.log4j.DailyRollingFileAppender.0770ee72-2206-4414-ade9-66eb4a24c184] - CTGDIS087I Iterating.
2021-05-06 19:20:54,091 DEBUG [org.apache.log4j.DailyRollingFileAppender.0770ee72-2206-4414-ade9-66eb4a24c184] - [ESBMQInput] CTGDIS057I Hook before_execute not enabled.

2021-05-06 19:32:27,305 ERROR [org.apache.log4j.DailyRollingFileAppender.519ed276-bcdf-4e05-995a-e9ca81b77b96] - [ESBMQInput] CTGDIS810E handleException - cannot handle exception , get
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:196)
at java.lang.Thread.join(Thread.java:675)
at com.ibm.di.connector.JMSConnector.processReceiverThread(JMSConnector.java:484)
at com.ibm.di.connector.JMSConnector.getNextEntry(JMSConnector.java:455)
at com.ibm.di.server.AssemblyLineComponent.executeOperation(AssemblyLineComponent.java:3372)
at com.ibm.di.server.AssemblyLineComponent.getnext(AssemblyLineComponent.java:932)
at com.ibm.di.server.AssemblyLine.msGetNextIteratorEntry(AssemblyLine.java:3715)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3414)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:3026)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:3009)
at com.ibm.di.server.AssemblyLine.executeAL(AssemblyLine.java:2975)
at com.ibm.di.server.AssemblyLine.run(AssemblyLine.java:1338)
2021-05-06 19:32:42,277 ERROR [org.apache.log4j.DailyRollingFileAppender.5b968183-28f0-4d84-9f58-7ba771485e58] - [ESBMQInput] CTGDIS810E handleException - cannot handle exception , get
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:196)
at java.lang.Thread.join(Thread.java:675)
at com.ibm.di.connector.JMSConnector.processReceiverThread(JMSConnector.java:484)
at com.ibm.di.connector.JMSConnector.getNextEntry(JMSConnector.java:455)
at com.ibm.di.server.AssemblyLineComponent.executeOperation(AssemblyLineComponent.java:3372)
at com.ibm.di.server.AssemblyLineComponent.getnext(AssemblyLineComponent.java:932)
@


and so on. It error'd out and died. When I started it up with the GUI, no problems. None.

When I reinstated the previous version, it ran fine via the remote api.

In our dev environment, it is running fine via the remote api.

Any thoughts on this one? I have never seen this on an MQ iterator.

thanks

michele
Eddie Hartman
2021-05-07 22:05:25 UTC
Permalink
Googling 'java ibm mw java interrupted exception' it looks like you have to expect this at times. IBM recommends handling failures and reconnecting.

https://www.ibm.com/docs/en/ibm-mq/8.0?topic=environments-implementing-reconnection-logic-in-java-ee-application

You can do this with TDI so:

1. Set up a Resources/Connectors/RobustMQ Connector, configured like you do now.
2. Code the Default On Error Hook with something like this:
-----
// We don't want to end up in a tight loop, in case the connection (or
// re-init) continues to fail. So we keep count. Here I am using the
// lazy man's JIT variable definition
if (typeof(_reconnectCounter) == "undefined") {
_reconnectCounter = 1;
_maxRetries = 2;
}

// Log the exception
task.logmsg("ERROR", "Exception reading from MQ: " + error.exception.getValue());

// Now decide which exceptions to handle. I'm handling all exceptions here
if (error.toJSON().indexOf("Exception") < 0 ) {
throw error.exception.getValue(0);
}

// Fail if too many retries
if (_reconnectCounter++ >= _maxRetries) {
task.logmsg("FATAL", "Too many reconnect retries: " + _reconnectCounter);
throw error.exception.getValue(0);
}

// The AssemblyLineComponent functions that execute the Hook flows
// does not work here.
//thisConnector.doConnectorTerminate(true); // force it if need be
//thisConnector.doConnectorInitialize() ();

// So we try with the Connector Interface methods
var ci = thisConnector.connector;
ci.terminate();
ci.initialize(null);

// Since this is an iterator, we can simply skip this broken one
system.skipEntry();
-----

If your JMS Connector is writing instead of reading, use system.retryEntry() to apply the same work Entry to this Connector in the DataFlow.

I do not have a queue to test this on myself, so I used the FormEntry Connector and put some invalid chars in the Connection tab Raw Data Text parameter (id?1 in the first line) so the Parser would fail each time.

Let us know what you learn! And reach out if you want to look at it together.

/Eddie
Eddie Hartman
2021-05-09 07:00:06 UTC
Permalink
Oops, forgot something. Since your Connector is in Iterator mode, then initialisation must also include Selection. So my code should be amended as follows:
---
...
ci.initialize(null);
ci.selectEntries();
...
---
You could also add a wait, in case your connection loss was due to a transient issue: task.sleep(500); // wait 500 milliseconds

Also note that since the re-initialization happens in the Error Hook, if it fails then the AL stops. If you want to catch and retry due to init failure as well, you will need to wrap the code in a try-catch block.

The above re-connect code should work for most types of Connectors as well.

And as I wrote before, holler if you (or any valiant TDIers out there) want to talk about any of this :)

/Eddie
mue...@bc.edu
2021-05-10 12:50:17 UTC
Permalink
Thank you Eddie, I will try to fit this in today - we are going live with a new student system, so there is a lot going on.

I will let you know how it works

michele

Loading...