0 Replies Latest reply on Mar 16, 2011 10:43 PM by cschmidt001

    Unable to publish after remote JBoss JMS restart

    cschmidt001

      Hello all,

        I've been searching quite a bit for a solution to this problem, and would appreciate any assistance, TIA.  I have a local durable MDB consuming messages from a local topic, then publishing them to a topic on a remote jboss messaging instance.  I've confirmed that the MDB can successfully publish messages to the remote topic.  However, the MDB is unable to publish messages in the following scenario:

       

      I shut down the remote jboss instance, I get the expected warning in the local jboss logs: 

       

      011-03-16 21:55:18,774 TRACE [org.jboss.jms.server.endpoint.ServerSessionEndpoint] (WorkManager(2)-4) SessionEndpoint[rc-kpow0dlg-1-zw6v0dlg-tyrpht-04v2gs4] acknowledging transactionally 1 messages for TX(21304556237193217):ACTIVE

      2011-03-16 22:00:35,518 WARN  [org.jboss.resource.adapter.jms.JmsManagedConnection] (Thread-38) Handling jms exception failure: org.jboss.resource.adapter.jms.JmsManagedConnection@1f6d10f

      javax.jms.JMSException: Failure on underlying remoting connection

      at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:102)

      at org.jboss.remoting.ConnectionValidator$1.run(ConnectionValidator.java:744)

       

      Attempting to publish messages to the remote topic throws the following exception after each retry:

       

      2011-03-16 22:01:53,985 ERROR [org.jboss.messaging.util.ExceptionUtil] (WorkManager(2)-5) SessionEndpoint[wd-9u4b1dlg-1-zw6v0dlg-tyrpht-04v2gs4] createTopic [yd-9u4b1dlg-1-zw6v0dlg-tyrpht-04v2gs4]

      javax.jms.JMSException: There is no administratively defined topic with name:pendingBatching

                at org.jboss.jms.server.endpoint.ServerSessionEndpoint.createTopic(ServerSessionEndpoint.java:323)

                at org.jboss.jms.server.endpoint.advised.SessionAdvised.org$jboss$jms$server$endpoint$advised$SessionAdvised$createTopic$aop(SessionAdvised.java:110)

                at org.jboss.jms.server.endpoint.advised.SessionAdvised$createTopic_N1144803973659535745.invokeTarget(SessionAdvised$createTopic_N1144803973659535745.java)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                at org.jboss.jms.server.container.ServerLogInterceptor.invoke(ServerLogInterceptor.java:105)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.jms.server.endpoint.advised.SessionAdvised.createTopic(SessionAdvised.java)

                at org.jboss.jms.wireformat.SessionCreateTopicRequest.serverInvoke(SessionCreateTopicRequest.java:74)

                at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:143)

                at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)

                at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106)

                at org.jboss.remoting.Client.invoke(Client.java:1724)

                at org.jboss.remoting.Client.invoke(Client.java:629)

                at org.jboss.remoting.Client.invoke(Client.java:617)

                at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)

                at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)

                at org.jboss.jms.client.delegate.ClientSessionDelegate.org$jboss$jms$client$delegate$ClientSessionDelegate$createTopic$aop(ClientSessionDelegate.java:353)

                at org.jboss.jms.client.delegate.ClientSessionDelegate$createTopic_N1144803973659535745.invokeTarget(ClientSessionDelegate$createTopic_N1144803973659535745.java)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:92)

                at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)

                at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.jms.client.delegate.ClientSessionDelegate.createTopic(ClientSessionDelegate.java)

                at org.jboss.jms.client.JBossSession.createTopic(JBossSession.java:260)

                at org.jboss.resource.adapter.jms.JmsSession.createTopic(JmsSession.java:334)

                at com.companyName.appName.service.mdb.OutboundOrderListener.onMessage(OutboundOrderListener.java:35)

       

      I'd expect an exception at this point. But, once I restart the remote jboss instance, I'm _still_ observing the above exception each time the local MDB tries to publish to the remote topic. Does anyone know how to resolve this?

       

      Additional details follow:

      JBoss 5.1.0

      Jboss Messaging 1.4.3

       

       

      jms-ds.xml

      <tx-connection-factory>

            <jndi-name>XADefaultJMSProviderremoteJboss</jndi-name>

            <xa-transaction/>

            <rar-name>jms-ra.rar</rar-name>

            <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>

            <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>

            <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/remoteJbossJMS</config-property>

            <max-pool-size>1</max-pool-size>

            <depends>jboss.messaging:service=ServerPeer</depends>

         </tx-connection-factory>


         <mbean code="org.jboss.jms.jndi.JMSProviderLoader"

                name="jboss.messaging:service=JMSProviderLoader,name=remoteJbossJMS">

            <attribute name="ProviderName">remoteJbossJMS</attribute>

            <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

            <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>

            <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>

            <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>

                  <attribute name="Properties">

             java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

             java.naming.factory.url.pkgs=org.jnp.interfaces

             java.naming.provider.url=jnp://foo.dev.remoteJboss.companyName-inc.com:1099

            </attribute>

         </mbean>



       

      The mdb:

       

       

      package com.companyName.appName.service.mdb;



      import javax.annotation.Resource;

      import javax.ejb.ActivationConfigProperty;

      import javax.ejb.MessageDriven;

      import javax.jms.Connection;

      import javax.jms.ConnectionFactory;

      import javax.jms.JMSException;

      import javax.jms.Message;

      import javax.jms.MessageListener;

      import javax.jms.MessageProducer;

      import javax.jms.Session;

      import javax.jms.Topic;



      @MessageDriven(activationConfig = {

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

              @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "OutboundOrderListenerSubscription"),

              @ActivationConfigProperty(propertyName = "clientId", propertyValue = "OutboundOrderListener"),

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/orderBatchesBoundForOS"),

              @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),

              @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })

      public class OutboundOrderListener implements MessageListener{



                @Resource(mappedName = "java:XADefaultJMSProviderremoteJboss")

                private ConnectionFactory connectionFactory;


                @Override

                public void onMessage(Message message) {

                          Connection connection = null;

                          boolean sendOrderException = false;

                          try {

                                    connection = connectionFactory.createConnection();

                                    Session session = connection.createSession(false,

                                                        Session.AUTO_ACKNOWLEDGE);

                                    Topic topic = session.createTopic("pendingBatching");

                                    MessageProducer publisher = session.createProducer(topic);

                                    publisher.send(message);

                          } catch (JMSException e) {

                                    sendOrderException = true;

                                    // re-throw as run time exception because it indicates an

                                    // unrecoverable error

                                    throw new RuntimeException(e);

                          } finally {

                                    try {

                                              if (connection != null) {

                                                        connection.close();

                                              }

                                    } catch (JMSException e) {

                                              if (!sendOrderException) {

                                                        // re-throw as run time exception only if sending message

                                                        // didn't cause one

                                                        throw new RuntimeException(e);

                                              }

                                    }

                          }


                }

      }