6 Replies Latest reply on Jul 13, 2005 6:39 AM by sampr_s

    JBOSS 4.0.2 Messaging Problem

    sampr_s

      I have two instances of JBOSS 4.0.2 Application Server - each running on different machines.

      I configured a Queue with a JNDI name queue/SampleQueue in "Machine A"
      and started the "Machine A" giving the --host=10.250.11.26

      I deployed a servlet on JBOSS running in Machine B. This servlet looked-up the Queue deployed on "Machine A" . It failed with exception

      javax.jms.InvalidDestinationException: The destination QUEUE.SampleQueue does not exist

      However when the same code was run as a stand-alone java program, it worked .

      Is this a bug in 4.0.2 or is my configuration wrong?

      Please help.

      The Code:

      public void writeToJMS() {
      try {

      java.util.Properties jp = new java.util.Properties();
      jp.put(Context.PROVIDER_URL, "jnp://10.250.11.26:1099");
      jp.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      Context context = new javax.naming.InitialContext(jp);
      QueueConnectionFactory qcf =
      (QueueConnectionFactory) context.lookup("java:/XAConnectionFactory");
      Queue ioQueue = (Queue) context.lookup("queue/SampleQueue");

      QueueConnection qc = qcf.createQueueConnection();
      QueueSession qs =
      qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      QueueSender queueSender = qs.createSender(ioQueue);
      System.out.println("Got the queue 1");
      TextMessage outMessage = qs.createTextMessage();
      System.out.println("Adding Text");
      outMessage.setText("hello");
      // Ask the QueueSender to send the message we have created
      System.out.println(
      "Sending the message to " + ioQueue.getQueueName());
      System.out.println(ioQueue.toString());
      queueSender.send(outMessage);
      System.out.println(
      "Sent ....... " );


      } catch (Exception ex) {
      ex.printStackTrace();
      }
      }



        • 1. Re: JBOSS 4.0.2 Messaging Problem
          sampr_s

          After enabling the Trace for both java client and servlet following were the output

          Looks like the TracingInterceptor is one which is causing this problem.
          Anybody faced the similar problem?


          Java Client
          [org.jboss.mq.SpySession] New session SpySession@20716290[tx=false ack=AUTO txid=null RUNNING connection=Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]]
          [org.jboss.mq.SpyMessageProducer] New message producer SpyMessageProducer@14867177[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@20716290[tx=false ack=AUTO txid=null RUNNING connection=Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]]]
          [org.jboss.mq.SpySession] Adding producer SpyMessageProducer@14867177[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@20716290[tx=false ack=AUTO txid=null RUNNING connection=Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]]]
          [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_pong, msgID: -2147483644
          [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.PingMsg19859865[msgType: m_pong, msgID: -2147483644, error: null]
          [org.jboss.mq.il.uil2.UILClientILService] Begin handleMsg, msgType: 24
          [org.jboss.mq.Connection] PONG serverTime=1121161142359 Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]
          [org.jboss.mq.il.uil2.UILClientILService] End handleMsg
          [org.jboss.mq.SpyMessageProducer] Sending message SpyMessageProducer@14867177[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@20716290[tx=false ack=AUTO txid=null RUNNING connection=Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]]]
          SpyTextMessage {
          Header {
          jmsDestination : QUEUE.SampleQueue
          jmsDeliveryMode : 2
          jmsExpiration : 0
          jmsPriority : 4
          jmsMessageID : ID:6-11211611424371
          jmsTimeStamp : 1121161142437
          jmsCorrelationID: null
          jmsReplyTo : null
          jmsType : null
          jmsRedelivered : false
          jmsProperties : {}
          jmsPropReadWrite: true
          msgReadOnly : false
          producerClientId: ID:6
          }
          Body {
          text :hello
          }
          }
          [org.jboss.mq.SpySession] Sending message to server ID:6-11211611424371 SpySession@20716290[tx=false ack=AUTO txid=null RUNNING connection=Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]]
          [org.jboss.mq.Connection] SendToServer message=ID:6-11211611424371 Connection@11807935[token=ConnectionToken:ID:6/e6ff58c58aba3e9fd30c23f34a9fe877 rcvstate=STOPPED]
          [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, round-trip msg=org.jboss.mq.il.uil2.msgs.AddMsg29987161[msgType: m_addMessage, msgID: 5, error: null]
          [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.AddMsg29987161[msgType: m_addMessage, msgID: 5, error: null]
          [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_addMessage, msgID: 5
          [org.jboss.mq.il.uil2.SocketManager] Found replyMap msg: org.jboss.mq.il.uil2.msgs.AddMsg29987161[msgType: m_addMessage, msgID: 5, error: null]
          [org.jboss.mq.il.uil2.SocketManager] Read msg reply: org.jboss.mq.il.uil2.msgs.AddMsg29987161[msgType: m_addMessage, msgID: 5, error: null]
          [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.AddMsg29987161[msgType: m_addMessage, msgID: 5, error: null]


          Servlet
          [org.jboss.mq.Connection] Checking clientID=null Connection@14141119[token=ConnectionToken:null/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]
          [org.jboss.mq.Connection] Ask for an id Connection@14141119[token=ConnectionToken:null/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]
          [org.jboss.mq.server.TracingInterceptor] CALLED : getID
          [org.jboss.mq.server.TracingInterceptor] RETURN : getID
          [org.jboss.mq.Connection] ClientID established Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]
          [org.jboss.mq.SpySession] New session SpySession@29066900[tx=false ack=AUTO txid=null RUNNING connection=Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]]
          [org.jboss.mq.SpyMessageProducer] New message producer SpyMessageProducer@8461840[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@29066900[tx=false ack=AUTO txid=null RUNNING connection=Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]]]
          [org.jboss.mq.SpySession] Adding producer SpyMessageProducer@8461840[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@29066900[tx=false ack=AUTO txid=null RUNNING connection=Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]]]
          [org.jboss.mq.SpyMessageProducer] Sending message SpyMessageProducer@8461840[ dest=QUEUE.SampleQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@29066900[tx=false ack=AUTO txid=null RUNNING connection=Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]]]
          SpyTextMessage {
          Header {
          jmsDestination : QUEUE.SampleQueue
          jmsDeliveryMode : 2
          jmsExpiration : 0
          jmsPriority : 4
          jmsMessageID : ID:1-11211616021401
          jmsTimeStamp : 1121161602140
          jmsCorrelationID: null
          jmsReplyTo : null
          jmsType : null
          jmsRedelivered : false
          jmsProperties : {}
          jmsPropReadWrite: true
          msgReadOnly : false
          producerClientId: ID:1
          }
          Body {
          text :hello
          }
          }
          [org.jboss.mq.SpySession] Sending message to server ID:1-11211616021401 SpySession@29066900[tx=false ack=AUTO txid=null RUNNING connection=Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]]
          [org.jboss.mq.Connection] SendToServer message=ID:1-11211616021401 Connection@14141119[token=ConnectionToken:ID:1/9cdce641e0b47fd4e6d43d565d8deff5 rcvstate=STOPPED]
          [org.jboss.mq.server.TracingInterceptor] CALLED : addMessage
          [org.jboss.mq.server.TracingInterceptor] ARG : SpyTextMessage {
          Header {
          jmsDestination : QUEUE.SampleQueue
          jmsDeliveryMode : 2
          jmsExpiration : 0
          jmsPriority : 4
          jmsMessageID : ID:1-11211616021401
          jmsTimeStamp : 1121161602140
          jmsCorrelationID: null
          jmsReplyTo : null
          jmsType : null
          jmsRedelivered : false
          jmsProperties : {}
          jmsPropReadWrite: true
          msgReadOnly : false
          producerClientId: ID:1
          }
          Body {
          text :hello
          }
          }
          2005-07-12 15:16:42,140 DEBUG [org.jboss.mq.security.SecurityManager] No SecurityMetadadata was available for SampleQueue using default security config
          2005-07-12 15:16:42,140 TRACE [org.jboss.mq.security.SecurityMetadata] Adding role: Role {name=guest;read=true;write=true;create=true}
          2005-07-12 15:16:42,140 TRACE [org.jboss.mq.security.SecurityManager] Checking authorize on subjectInfo: SubjectInfo {subject=Subject:
          Principal: guest
          Principal: Roles(members:j2ee,guest,john)
          ;principal=null;roles=Roles(members:j2ee,guest,john) for rolePrincipals [guest]
          2005-07-12 15:16:42,140 TRACE [org.jboss.mq.server.TracingInterceptor] EXCEPTION : addMessage:
          javax.jms.InvalidDestinationException: This destination does not exist! QUEUE.SampleQueue
          at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:406)
          at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:390)
          at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:136)
          at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:153)
          at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:279)
          at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:136)
          at org.jboss.mq.il.jvm.JVMServerIL.addMessage(JVMServerIL.java:136)
          at org.jboss.mq.Connection.sendToServer(Connection.java:1020)
          at org.jboss.mq.SpySession.sendMessage(SpySession.java:1005)
          at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:265)
          at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:199)
          at com.test.JmsTestServlet.writeToJMS(JmsTestServlet.java:104)
          at com.test.JmsTestServlet.processRequest(JmsTestServlet.java:49)
          at com.test.JmsTestServlet.doGet(JmsTestServlet.java:61)

          • 2. Re: JBOSS 4.0.2 Messaging Problem
            sampr_s

            I am using a default configuration of 4.0.2.

            Also I tried the following options
            1) I have removed the jvm-il-service.xml
            2) Currently using uil2-service.xml
            3) Modifed jbossmq-service.xml to remove the interceptor.

            Still no luck.

            Please help!!


            • 3. Re: JBOSS 4.0.2 Messaging Problem
              genman

              javax.jms.InvalidDestinationException: This destination does not exist! QUEUE.SampleQueue

              Where or how are you deploying the queue "SampleQueue"?

              • 4. Re: JBOSS 4.0.2 Messaging Problem
                sampr_s

                I have deployed the SampleQueue in Machine A and trying to look-up from a servlet deployed on Machine B

                I have made the following entry in jbossmq-destinations-service.xml

                mbean code="org.jboss.mq.server.jmx.Queue"
                name="jboss.mq.destination:service=Queue,name=SampleQueue"
                /mbean



                Is this right?

                The same code works for a stand-alone program!!.
                However, it fails in the servlet deployed in another JBOSS 4.0.2.


                Also attached is the System.outs.

                Got the queue 1 [ This is after looking up the queue ]
                Adding Text [ This is when creating the textmessage ]
                Sending the message to SampleQueue [ This is just before the call queueSender.send(outMessage) ]

                And I get this exception soon after that!javax.jms.InvalidDestinationException: This destination does not exist! QUEUE.SampleQueue


                • 5. Re: JBOSS 4.0.2 Messaging Problem
                  sampr_s

                  After switching on the trace at the server where the queue is deployed,
                  I have the following information:

                  When the Standalone client is running:
                  Log file records few TRACE calls when the session is created and when the message is sent

                  When the Servlet is running:
                  There is NO activity in the Log file.
                  Looks like NONE of the calls are reaching the server even though I have following code :

                  jp.put(Context.PROVIDER_URL, "http://10.250.11.26:8080/invoker/JNDIFactory");
                   jp.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
                   Context context = new javax.naming.InitialContext(jp);


                  Also If try to lookup for a queue which is not in server it throws NameNotFoundException.

                  What is the problem? Please help!!



                  • 6. Re: JBOSS 4.0.2 Messaging Problem
                    sampr_s

                    After the following code change it worked!.

                    QueueConnectionFactory qcf =
                     (QueueConnectionFactory) context.lookup("ConnectionFactory");


                    from

                    QueueConnectionFactory qcf =
                     (QueueConnectionFactory) context.lookup("java:/XAConnectionFactory");



                    I still don't know what happened?