Bonjour je suis en train de développer une application utilisant JMS(jboss-messaging-1.4.0.SP3) sur un serveur jboss5.0.0. Je rencontre un petit souci j'ai une exception :
Exception occurred: org.jboss.jms.exception.MessagingNetworkFailureException
Elle est levée lors de l'exécution de la ligne :
queueConnection = queueConnectionFactory.createQueueConnection();
Dans ma console du server JBOSS l'erreur suivante est levée:
11:22:49,234 ERROR [BisocketServerInvoker] received new control socket for unrecognized listenerId: 4p7222-aufgj0-ft2o3rwl-1-ft2o3shu-9
Voici mon code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
/**
* The SimpleQueueSender class consists only of a main method,
* which sends several messages to a queue.
*
* Run this program in conjunction with SimpleQueueReceiver.
* Specify a queue name on the command line when you run the
* program. By default, the program sends one message. Specify
* a number after the queue name to send that number of messages.
*/
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class SimpleQueueSender {
/**
* Main method.
*
* @param args the queue used by the example and,
* optionally, the number of messages to send
*/
public static void main(String[] args) {
String queueName = null;
Context jndiContext = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSession queueSession = null;
Queue queue = null;
QueueSender queueSender = null;
TextMessage message = null;
final int NUM_MSGS;
if ( (args.length < 1) || (args.length > 2) ) {
System.out.println("Usage: java SimpleQueueSender " +
"<queue-name> [<number-of-messages>]");
System.exit(1);
}
queueName = new String(args[0]);
System.out.println("Queue name is " + queueName);
if (args.length == 2){
NUM_MSGS = (new Integer(args[1])).intValue();
} else {
NUM_MSGS = 1;
}
/*
* Create a JNDI API InitialContext object if none exists
* yet.
*/
try
{
jndiContext = new InitialContext();
} catch (NamingException e)
{
System.out.println("Could not create JNDI API " +"context: " + e.toString());
System.exit(1);
}
/*
* Look up connection factory and queue. If either does
* not exist, exit.
*/
try
{
queueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("ConnectionFactory");
queue = (Queue) jndiContext.lookup("queue/DLQ");
} catch (NamingException e)
{
System.out.println("JNDI API lookup failed: " +e.toString());
System.exit(1);
}
/*
* Create connection.
* Create session from connection; false means session is
* not transacted.
* Create sender and text message.
* Send messages, varying text slightly.
* Send end-of-messages message.
* Finally, close connection.
*/
try {
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
for (int i = 0; i < NUM_MSGS; i++)
{
message.setText("This is message " + (i + 1));
System.out.println("Sending message: " + message.getText());
queueSender.send(message);
}
/*
* Send a non-text control message indicating end of
* messages.
*/
queueSender.send(queueSession.createMessage());
} catch (JMSException e) {
System.out.println("Exception occurred: " +
e.toString());
} finally {
if (queueConnection != null) {
try {
queueConnection.close();
} catch (JMSException e) {}
}
}
}
} |
Auriez-vous une idée.
Partager