adrian, is it possible that the container is asking for connections too fast? I put
random sleeps in my client as well as in my server code which sends messages and the
error goes away. Again, right now my code does nothing but pass messages around.
Also both the client and server use the same MessageHelper class to send messages...
public class MessageHelper {
|
| public void sendMessage(TextMessage msg, String queueName) {
| Context jndiContext = null;
| QueueConnection queueConnection = null;
| QueueConnectionFactory ref = null;
| Queue queue = null;
|
| try {
| jndiContext = new InitialContext();
| ref =
(QueueConnectionFactory)jndiContext.lookup("ConnectionFactory");
| //ref =
(QueueConnectionFactory)jndiContext.lookup("java:comp/env/jms/QueueFactory");
| //ref =
(QueueConnectionFactory)jndiContext.lookup("jms/QueueFactory");
| queue = (Queue)jndiContext.lookup(queueName);
| } catch (NamingException e) {
| System.out.println("MessageHelper generated a NamingException:
");
| System.out.println(e.getMessage());
| e.printStackTrace();
| }
|
| try {
| queueConnection = ref.createQueueConnection();
| QueueSession queueSession =
queueConnection.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
| QueueSender queueSender = queueSession.createSender(queue);
|
| queueSender.send(msg);
|
| //queueSender.close();
| //queueSession.close();
|
| queueConnection.close();
| queueConnection = null;
|
| // jndiContext.close();
|
| }
| catch (JMSException e) {
| System.out.println("MessageHelper generated a JMSException: ");
| System.out.println(e.getMessage());
| e.printStackTrace();
| } finally {
| try {
| if(queueConnection != null) {
| System.out.println("MessageHelper - Connection
not closed, reclosing connection");
| queueConnection.close();
| queueConnection = null;
| }
|
| } catch (JMSException e) {
| System.out.println("MessageHelper generated a
JMSException: ");
| System.out.println(e.getMessage());
| e.printStackTrace();
| }
| }
| }
| }
|
<a
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825059#3825059">View
the original post</a>
<a
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825059>Reply
to the post</a>
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user