I am using the java:/JmsXA connection factory to achieve transaction feature in JMS. I am publishing the messages from a EJB for every operation perfomed via the same (ejb) to a particular Topic. When the amount of clients using the EJB this is less then there seems no problem. But when the number of clients gets increased then i am running into all sort of problems. I see the below mentioned exception in the logs printed contiounsly,
Caused by: javax.jms.JMSException: Could not create a session: javax.resource.ResourceException: No ManagedConnections Available!
Below is the code snippet used for publishing the message,
myConnection = fact.createTopicConnection();
topicSession = myConnection.createTopicSession(true, 0 );
topicPublisher = topicSession.createPublisher(myTopic);
//Construct the Message
ObjectMessage message = topicSession.createObjectMessage();
//Publish the message
catch (JMSException jmse)
throw new MyException("JMS Exception occured while publishing a message", jmse);
Please let me know when and why the above mentioned exception is thrown and what should done to overcome this.
Note: Jboss version is 3.2.1
You don't need to create a new connection for each and every message you want to send.
To be transactionnal you need to create a new session though
BTW, your code create a connection but it does not close it ... That's normal you got those exceptions