Introduction
We recently faced an issue with JMS receiver communication channels in SAP PI which are frequently throwing error in case of network,connectivity issues or when the MQ queue manager is restarted.JMS receiver channels unable to reconnect to WebSphere - MQ queue manager and every time we need to manually restart the communication channels in case of this issue.
Error
JMS channel fails to connect to MQ whenever any network problem occurs. This generates the following error
“MQJMS1016: an internal error has occurred. Please contact your system administrator.
Detail: java.lang.NullPointerException: in sending to destination queue: //TESTXXX”.
Root Cause
The main reason for this issue is that Queue Manager which would break all the connections that are idle for more than 10 minutes interval and whenever a network problem occurs the PI JMS channel goes down.
This problem is caused due to a limitation in all versions of Websphere MQ including 6.x that has been acknowledged by IBM. Websphere MQ diverges from the JMS specification and other JMS products in its behavior of notifying the JMS connection exception listener. (javax.jms.ExceptionListener).
When only a javax.jms.QueueSender object is created from a javax.jms.Session object associated with a javax.jms.Connection object, errors/drops in the connection do not invoke the associated exceptionlistener set on the connection object. Instead an exception is encountered only when the next JMS message (javax.jms.Message) is sent through the JMS sender.
However, when a MessageListener (asynchronous) is created on a Session object associated with a JMS Connection, WSMQ informs the connection's ExceptionListener immediately.There are no current solutions to the problem, only work arounds are provided.
As per the SAP note :0000948016 we need to create a ABAP program and set up batch jobs and schedule it to start and stop the JMS receiver communication channels in SAP PI.
https://websmp230.sap-ag.de/sap/support/notes/convert2pdf/0000948016?sap-language=EN
ABAP program Code
*&---------------------------------------------------------------------*
*& Report ZRESTART_JMS_RCVR_CHANNEL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZRESTART_JMS_RCVR_CHANNEL.
SET EXTENDED CHECK OFF.
DATA: client TYPE REF TO if_http_client.
DATA: cclient TYPE REF TO if_http_client.
DATA: dummy TYPE string,
subrc TYPE sysubrc.
PARAMETERS:
dest TYPE rfcdest.
DATA:
protocol(8) TYPE c VALUE 'HTTP/1.0',
path(128) TYPE c,
mandant TYPE symandt, " default sy-mandt,
username TYPE syuname, " default sy-uname,
password(128) TYPE c,
langu TYPE sylangu,
listen TYPE c VALUE space,
scheme TYPE i VALUE 1.
DATA: host_str TYPE string,
service_str TYPE string.
DATA: ncolor TYPE i VALUE 4.
DATA : tx TYPE f, ta TYPE i, te TYPE i.
DATA : mintime TYPE f VALUE 1000000000.
DATA : t(10) TYPE p.
INCLUDE RSHTTPPIN_DISPLAY .
DATA: wa_inout TYPE type_alv_entry,
l_columns TYPE REF TO cl_salv_columns_table,
l_column TYPE REF TO cl_salv_column_table,
l_status TYPE i,
l_string TYPE string.
START-OF-SELECTION.
GET RUN TIME FIELD ta.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = dest
IMPORTING
client = client
EXCEPTIONS
destination_not_found = 1
internal_error = 2
argument_not_found = 3
destination_no_authority = 4
plugin_not_active = 5
OTHERS = 5.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 3.
MESSAGE s000(sr) WITH
'Create failed: Argument not found'. "#EC NOTEXT
WHEN 4.
MESSAGE s000(sr) WITH
'Create failed: destionation no authority'. "#EC NOTEXT
WHEN 5.
MESSAGE s000(sr) WITH
'Create failed: plugin not active'. "#EC NOTEXT
WHEN OTHERS.
MESSAGE s000(sr) WITH 'Create failed'. "#EC NOTEXT
ENDCASE.
EXIT.
ENDIF.
client->propertytype_accept_cookie = client->co_prompt.
IF NOT username IS INITIAL AND
NOT password IS INITIAL.
DATA: password_str TYPE string.
password_str = password.
DATA: lclient TYPE REF TO cl_http_client,
user TYPE string.
user = username.
lclient ?= client.
CALL METHOD client->authenticate
EXPORTING
client = mandant
username = user
password = password_str
language = langu.
"call method lclient->authentication.
"Set request method
ENDIF.
CALL METHOD client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'GET'.
"Set request protocol
IF protocol = 'HTTP/1.0'.
CALL METHOD client->request->set_header_field
EXPORTING
name = '~server_protocol'
value = 'HTTP/1.0'.
ELSE.
CALL METHOD client->request->set_header_field
EXPORTING
name = '~server_protocol'
value = 'HTTP/1.1'.
ENDIF.
dummy = path.
cl_http_utility=>set_request_uri( request = client->request
uri = dummy ).
CALL METHOD client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = dummy.
MESSAGE s000(sr) WITH dummy.
EXIT.
ENDIF.
IF listen IS INITIAL.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = dummy.
MESSAGE s000(sr) WITH dummy.
EXIT.
ENDIF.
ELSE.
CALL METHOD client->listen
RECEIVING
client = cclient
EXCEPTIONS
http_communication_failure = 1
http_no_open_connection = 2.
IF sy-subrc = 0.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = dummy.
MESSAGE s000(sr) WITH dummy.
EXIT.
ENDIF.
ELSE.
IF sy-subrc <> 0.
MESSAGE s000(sr) WITH 'communication error'.
EXIT.
ENDIF.
ENDIF.
ENDIF.
wa_inout-name = text-005.
CALL METHOD client->response->get_status(
IMPORTING code = l_status ).
wa_inout-value = l_status.
CONDENSE wa_inout-value.
write:/ wa_inout-name, wa_inout-value.
wa_inout-name = text-004.
CALL METHOD client->response->get_status(
IMPORTING reason = l_string ).
wa_inout-value = l_string.
write:/ wa_inout-name, wa_inout-value.
wa_inout-name = text-006.
wa_inout-value = t.
CONDENSE wa_inout-value.
CONCATENATE wa_inout-value text-007 INTO wa_inout-value
SEPARATED BY space.
write:/ wa_inout-name, wa_inout-value.
ABAP report ‘ZRESTART_JMS_RCVR_CHANNEL’will takes HTTP Destination's [START and STOP] as input and triggers Connection test for the same.
For every receiver JMS channel, two variants are created that would pass the StartChannelHTTP Destination and StopChannelDestination respectively. Finally, a batch job "ZRESTART_JMS_REC" is to be created with two steps.
First step is to call the Report "ZRESTART_JMS_RCVR_CHANNEL" with Stop variant.
Second step to call the Report with Start Variant. It’s scheduled to be executed a periodic intervals.
This process will prevent all Receiver JMS channels to be automatically start and stop the channels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 |