Skip to main content

Cannot consume JMS messages

Please note these forums are being decommissioned and use the new and improved forums at
3 replies [Last post]
Joined: 2011-08-03

Hi all,

We recently moved to a new machine - so we thought of installing newest Glassfish on the new machine.
So we installed Glassfish 4 on the new machine and copied the same code. This code was working fine with Glassfish 3.

We are able to put messages in the queue but cannot retrieve it on the other side of JMS.

Here is the code of the consumer class :-

@MessageDriven(mappedName = "jms/SimpleQueue") // to process JMS messages asynchronously
public class AltCsoThread implements MessageListener {

private static final Category log = Category.getInstance(AltCsoThread.class);

public void onMessage(Message message) {

log.debug("On other side of JMS queue") ;
try {"Got message from JMS Queue::: " + ((ObjectMessage)message).getObject() + " @" + System.currentTimeMillis());

TranslatorFactory TF = new TranslatorFactory();
com.XXX.altcso.translator.Translator myTrans = TF.getTranslator();
TranslationRequest request = new TranslationRequest();

request = (TranslationRequest)((ObjectMessage)message).getObject();"sending the request to Systran Translator");
TranslationResponse response = myTrans.translate(request);"Got response back::: " + response.isSuccessFlag());
} catch (JMSException e) {

This class is not getting invoked at all. Any idea why that would happen? Thanks!


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-12-18

This is a general MDB use case. Please make sure you are sending/listening to/from the same queue which is deployed on the same target.

Was the MDB deployed successfully? Without the MDB, can a standalone queue receiver get the messages? Did you see any exception logged in server logs?

Joined: 2011-08-03

I did fresh installation of Glassfish 4 and it resolved the issue. The old version was copied from another directory and I think that was creating problem. I removed all previous installations and did a new one.

I have faced this problem in past also. You cannot copy an existing Glassfish to another machine and expect it to work. Apparently, Glassfish writes some installation specific files which stop it to work from copied location.

Joined: 2011-08-03

I am using open source glassfish 4