-
1. Re: Using transacted TopicSessions in Session Beans
adrian.brock Dec 22, 2003 1:16 PM (in response to rudivankeirsbilck)I've answered this in the sticky FAQ topic
Regards,
Adrian -
2. Re: Using transacted TopicSessions in Session Beans
rudivankeirsbilck Dec 23, 2003 3:54 AM (in response to rudivankeirsbilck)Thanks, I really needed that.
The Sticky FAQ does not answer the part of the question if I need to close the TopicConnection and TopicSession myself or if the container will do that if my session bean is container managed.
I would prefer to work with container managed beans since I actually have two session beans that will publish messages and I would like both of them to work in the same transaction. If however, I need to do bean managed transactions to be able to close the jms resources then both beans will start their own UserTransaction...
Rudi. -
3. Re: Using transacted TopicSessions in Session Beans
rudivankeirsbilck Dec 23, 2003 4:27 AM (in response to rudivankeirsbilck)I will need some more help please.
Now that I am using java:/JmsXA I am getting the following exception when getting a TopicSession:
11:13:59,400 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jms.JmsSession@63b5ed
java.lang.Exception: STACKTRACE
at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:282)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:506)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createTopicSession(JmsSessionFactoryImpl.java:159)
at com.bluespace.core.implementation.jms.JMSFacadeDefaultImplementation.createTopicSession(JMSFacadeDefaultImplementation.java:20)
at com.bluespace.core.implementation.jms.JMSFacadeDefaultImplementation.getTopicResources(JMSFacadeDefaultImplementation.java:37)
at com.bluespace.core.implementation.events.publishers.abstracts.BlueSpacePublisher.acquireResources(BlueSpacePublisher.java:168)
at com.bluespace.core.implementation.events.publishers.abstracts.BlueSpacePublisher.publish(BlueSpacePublisher.java:207)
The code I am using to do this is:
TopicConnection connection = (TopicConnectionFactory) initialContext.lookup("java:/JmsXA");
TopicSession session = connection.createTopicSession(true, TopicSession.SESSION_TRANSACTED);
Why is it closing the connection I just created?
Rudi. -
4. Re: Using transacted TopicSessions in Session Beans
adrian.brock Dec 23, 2003 5:58 AM (in response to rudivankeirsbilck)The sessions are pooled behind the scenes. It is like the jdbc connection pool.
You should do the same close to return it to the pool:
getResources();
try
{
// Use resources
}
finally
{
closeResources();
}
Regards,
Adrian