Messages are not Received by the JMS Consumers
Problem Description
JMS messages are not received by the JMS consumers.
|
Scenario Type: |
Error analysis |
|
SAP NetWeaver Component: |
J2EE Engine |
|
Validity: |
J2EE Engine 6.30 and higher |
Possible Error Causes
-
Message is not sent at all.
-
Asynchronous receiver is blocked inside the onMessage() method.
-
Asynchronous receiver is garbage collected.
-
Message is classified as dead .
-
Transacted Message Driven Bean (MDB) is using non-XA factory.
-
There is a second queue receiver subscribed to the destination.
-
Client is not committing or acknowledging and the message delivery is blocked.
-
Connection is not started.
Decision Roadmap
Analysis
Check if the message is correctly sent
If the message is persistent (that is you use the default delivery mode), then it will appear in the database.
To check it, in the Telnet administrator tool execute the following commands:
|
Jump 0 add configuration show_config_value jms_provider/DEFAULT lockOwnerClusterId jump XXX (where XXX is the output form the previous command) add jms jms list destinations |
Search your destination and find the destination ID.
Issue the following statement in the server process database:
|
Select count(*) from bc_jmsqueue where dstid=<destination ID> where ack = 0; |
If the message are sent correctly, then the number will be bigger than zero.
If the number is zero:
-
check the log for possible exceptions during sending
-
check if the application is sending properly the messages
-
if you use transactions, then perform commit
In case the message is not coming to an asynchronous receiver or to MDB
In case the message is not coming to a asynchronous receiver or to a MDB, then you perform several thread dumps. It could be that the thread that serves the messages is blocked from the application. Search for thread blocked in
|
at MyJmsClient.onMessage(MyJmsClient.java:69) at com.sap.jms.client.session.Session.run(Session.java:527) |
where MyJmsClient is the class from the application.
If there is such a blocked thread, contact the application provider.
The messages may stop coming, if an application does not keep a reference to its asynchronous consumer
The messages will come as long as the consumer is not garbage collected. Check in the application code if the reference to the consumer is stored.
Increase the value of the log of the location com.sap.jms to ALL , and search in the trace file for closing info from the finalizing thread.
If the application is losing reference to its JMS objects and they are being garbage collected, contact the application vendor.
The messages for a queue are classified as dead
The messages for a queue will be classified as dead in case an exception has rolled back the JMS session or threw an exception inside the method onMessage() more than the number of times specified by the system administrator (the default value is 5 times ).
To analyze for that problem, use in the Telnet console:
|
Jump 0 add configuration show_config_value jms_provider/DEFAULT lockOwnerClusterId jump XXX (where XXX is the output form the previous command) add jms jms list deadmsgs |
If there are messages for the queue where messages are not received, then check with the application vendor if such scenario is normal (rolling back messages many times). If this is the expected behavior then check SAP Note 777930 for more information about how to switch off this feature on the server process.
Messages may not come to MDB that uses transaction but takes the connection from non-XA connection factory
Problem appears when non-XA factory is used with MDB. To analyze the problem, perform a thread dump, there should be a thread that has the following line in the stack trace:
|
at com.sap.jms.client.session.Session.waitCommit(Session.java:2630) |
Solution
Usage ofXA factories
jmsfactory/default/XATopicConnectionFactory or jmsfactory/default/XAQueueConnectionFactory in the deployment descriptor and redeploying the application will solve the problem.
For more information, see SAP note 721295.
Messages may not come to a queue receiver if there is another queue receiver
Messages may not come to a queue receiver if there is another queue receiver that is subscribed to the queue and the second one may take the messages.
To analyze the problem use the following:
|
Jump 0 add configuration show_config_value jms_provider/DEFAULT lockOwnerClusterId jump XXX (where XXX is the output form the previous command) add jms jms list consumers |
Check if there is only one consumer for the queue that is not receiving the messages. If there is more than one consumer, consult the application vendor to check if that behavior is normal.
Acknowledgement Mode
Messages will not be delivered after some time, in case an application uses the acknowledgment mode Session.CLIENT_ACKNOWLEDGE or Session.SESSION_TRANSACTED , consumes several hundred messages, but the application does not invoke session.commit() nor message.acknowledge() nor is the session enlisted in a global transaction.
To analyze this problem check the code of the application and consult the application vendor.
Connection is not started
If the application is not calling connection.start() method then no messages will be received.
Check if this method is called in the application’s code.