A machine-dependent problem with JBossMQ.
arabin Feb 4, 2004 5:40 PMI am running JBoss 3.2.3 on my Linux machine (ip address 192.168.1.21), java version 1.4.2_01-b06, mixed mode
I am also running java client on my windows xp machine, the same JVM version.
Here is my program:
/////////////////////////////////// Start /////////////////////////////////////////
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.jms.*;
import java.util.Properties;
public class exampleMessageSender
{
public static final String DELIMITER = ":";
public static final String NAMING_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
public static final String URL_PKG_PREFIXES = "org.jboss.naming:org.jnp.interfaces";
public static final String JNP = "jnp://";
public static final String QUEUE_CONNECTION_FACTORY = "UIL2XAConnectionFactory";
public static String PORT_INE = "1099";
public static void main (String args [])
{
Properties prop = new Properties ();
String ip = "192.168.1.21";
String port = PORT_INE;
prop.put (Context.INITIAL_CONTEXT_FACTORY, NAMING_CONTEXT_FACTORY);
prop.put (Context.PROVIDER_URL, JNP + ip + DELIMITER + port);
prop.put (Context.URL_PKG_PREFIXES, URL_PKG_PREFIXES);
try
{
InitialContext initCtx = new InitialContext (prop);
QueueConnectionFactory qfactory =
(QueueConnectionFactory)initCtx.lookup(QUEUE_CONNECTION_FACTORY);
QueueConnection qcon = qfactory.createQueueConnection();
QueueSession qses = qcon.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue) initCtx.lookup ("queue/A");
QueueSender qsender = qses.createSender(queue);
TextMessage tm = qses.createTextMessage();
System.out.println("Sending");
qsender.send (tm, DeliveryMode.NON_PERSISTENT,
Message.DEFAULT_PRIORITY, 1500000);
System.out.println("Sent");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
/////////////////////////////////// End /////////////////////////////////////////
In the java console http://192.168.1.21:8080/jmx-console/HtmlAdaptor I am trying to see what is going on after I execute the program on the client.
I am looking at the domain jboss.mq.destination, Queue queue/A (Name A, jndiName queue/A, that is the standard destination from the jboss setup, I did not change it)
I see that there are no receivers attached to the queue (that is what I need), using the operation on MBean in jmx-console:
listReceivers
java.util.ArrayList
MBean Operation.
Also I see that QueueDepth is still 0, even though I sent the message and the client finished OK.
At the same time operations
listMessageCounterHistory
java.lang.String
MBean Operation.
And
listMessageCounter
java.lang.String
MBean Operation.
Show me that there is a message in the queue.
How can that be?
Also, if I setup a listener to that queue, the callback onMessage of the listener is never called. I put a print statement there and I perfectly see that.
Can you tell me what is going on?
It looks the problem is perfectly reproducible with this Linux machine. However, if I use another Linux machine for JBoss server, it behaves as I expect –
QueueDepth becomes 1, when the listener is not set to the queue, and when the listener is set to the queue, the callback onMessage is called.
The same problem can be seen on the earlier version of JBoss 3.2.2RC3
Any comments?