0 Replies Latest reply on Mar 8, 2002 12:09 AM by Narinder Singh Deonia

    Strange behavior while publishing to a remote topic.

    Narinder Singh Deonia Newbie

      Hi

      I have following scenario

      server1 server2
      (JBoss 2.4.4 (JBoss 2.4.4 running running my EJBs) JMS service and a topic)
      EJB -------------->publish to topic

      It is working fine if both the servers are running. I have a
      requirement that EJB's should work normally even if the server2 (running JMS) goes down.
      but as soon as the JMS server goes down i get following exception and the transaction is rolled back.


      [WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=server1//49, BranchQual=] errorCode=XAER_RMERR
      javax.transaction.xa.XAException
      at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:169)
      at org.jboss.tm.TxCapsule.prepareResources(TxCapsule.java:1411)
      at org.jboss.tm.TxCapsule.commit(TxCapsule.java:330)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:406)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:286)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      [WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=server1//49, BranchQual=] errorCode=XAER_RMERR
      javax.transaction.xa.XAException
      at org.jboss.mq.SpyXAResource.rollback(SpyXAResource.java:201)
      at org.jboss.tm.TxCapsule.rollbackResources(TxCapsule.java:1540)
      at org.jboss.tm.TxCapsule.commit(TxCapsule.java:347)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:406)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:286)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      [INFO,WorkflowPool] Resource 'org.jboss.pool.jdbc.xa.wrapper.XAResourceImpl@6fc208' enlisted for 'org.jboss.pool.jdbc.xa
      .wrapper.XAConnectionImpl@3bc473'.

      I am using a session bean to publish to the topic
      it is as following

      public void ejbCreate() {
      try {
      Context context = new InitialContext();
      topic = (Topic)context.lookup(topic_JNDI);
      TopicConnectionFactory factory = (TopicConnectionFactory)
      context.lookup(connection_JNDI);
      topicConnection = factory.createTopicConnection();
      }
      catch (Exception e) {
      // Suppress it
      }
      }

      public void publish(String eventId, Event event) throws NamingException {

      TopicSession topicSession = null;
      try {
      if (topicConnection != null) {
      TopicPublisher topicPublisher = null;
      topicSession = topicConnection.createTopicSession(true,
      Session.AUTO_ACKNOWLEDGE);
      topicPublisher = topicSession.createPublisher(topic);
      ObjectMessage message = topicSession.createObjectMessage();
      message.setObject(event);
      message.setStringProperty(EventConstants.Event, eventId);
      topicPublisher.publish(message);
      }
      else {
      System.out.println("Unable to send event : " + eventId);
      }
      }
      catch(Exception e) {
      // Suppress it
      }
      finally {
      if (topicSession != null) {
      try {
      topicSession.close();
      }
      catch (Exception e) {
      e.printStackTrace();
      }
      }
      }
      }


      Can anybody tell me what's happenning here?

      Regards
      Narinder