Hi, I have 2 JBoss instances running.  One is hosting my topic and JMS stuff.  
The other is trying to publish a message to that topic.  If I set it up so that 
there is a durable subscription on that topic then I get the following error on 
my TopicSession.commit() call:


  | Caused by: javax.jms.JMSException: Transaction is not active for commit
  |     at org.jboss.mq.pm.Tx.commit(Tx.java:169)
  |     at org.jboss.mq.pm.TxManager.rollbackTx(TxManager.java:118)
  |     at 
org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:458)
  |     at 
org.jboss.mq.server.JMSServerInterceptorSupport.transact(JMSServerInterceptorSupport.java:186)
  |     at 
org.jboss.mq.security.ServerSecurityInterceptor.transact(ServerSecurityInterceptor.java:182)
  |     at 
org.jboss.mq.server.TracingInterceptor.transact(TracingInterceptor.java:438)
  |     at 
org.jboss.mq.server.JMSServerInvoker.transact(JMSServerInvoker.java:186)
  |     at 
org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:166)
  |     at 
org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:358)
  |     at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
  |     at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
  |     ... 1 more
  | 2005-05-04 18:29:56,123 DEBUG [org.apache.catalina.core.StandardWrapper]   
Returning non-STM instance
  | 

Now, the message does gets published to the topic but this exception bubbles up 
and rolls back other stuff I need to do.  Now if I didn't set up the topic to 
have a durable subscription then I don't get this error.  What am I doing wrong 
here?  The code to publish looks something like:



  |         Destination destination =
  |             (Destination)ServiceLocator.lookup(topicDestination);
  |         ConnectionFactory jmsConnectionFactory =
  |             (ConnectionFactory)ServiceLocator.lookup(connectionFactoryName);
  |         Connection connection = null;
  |         Session session = null;
  |         MessageProducer sender = null;
  |         boolean commit = false;
  |         try {
  |                 // A topic
  |                 connection = ((TopicConnectionFactory)jmsConnectionFactory).
  |                     createTopicConnection(jmsUserName, jmsPassword);
  |                 session =
  |                     ((TopicConnection)connection).createTopicSession(true,
  |                         Session.AUTO_ACKNOWLEDGE);
  |                 sender = ((TopicSession)session).createPublisher(
  |                         (Topic)destination);
  |                 for (Iterator iter = events.iterator(); iter.hasNext();) {
  |                     ObjectMessage message =
  |                         session.createObjectMessage((IEvent)iter.next());
  |                     ((TopicPublisher)sender).publish(message);
  |                 }
  |             commit = true;
  |         } finally {
  |             if (sender != null) {
  |                 sender.close();
  |             }
  |             if (session != null) {
  |                 if (commit) {
  |                     session.commit();  // Dies here if a durable 
subscription is set on the topic.
  |                 } else {
  |                     session.rollback();
  |                 }
  |                 session.close();
  |             }
  |             if (connection != null) {
  |                 connection.close();
  |             }
  |         }
  | 

Thanks for any help.
Mike


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876523#3876523

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876523


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to